Clover coverage report - Maven Clover report
Coverage timestamp: Tue Sep 16 2008 01:16:37 EEST
file stats: LOC: 102   Methods: 2
NCLOC: 60   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NodeNFP.java 0% 0% 0% 0%
coverage
 1    /*
 2    wsmo4j - a WSMO API and Reference Implementation
 3   
 4    Copyright (c) 2006, University of Innsbruck, Austria
 5   
 6    This library is free software; you can redistribute it and/or modify it under
 7    the terms of the GNU Lesser General Public License as published by the Free
 8    Software Foundation; either version 2.1 of the License, or (at your option)
 9    any later version.
 10    This library is distributed in the hope that it will be useful, but WITHOUT
 11    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 12    FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 13    details.
 14    You should have received a copy of the GNU Lesser General Public License along
 15    with this library; if not, write to the Free Software Foundation, Inc.,
 16    59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17    */
 18    package org.deri.wsmo4j.io.serializer.rdf;
 19   
 20    import java.io.*;
 21    import java.util.*;
 22   
 23    import org.omwg.ontology.*;
 24    import org.openrdf.model.*;
 25    import org.openrdf.vocabulary.RDFS;
 26    import org.wsmo.common.*;
 27   
 28    /**
 29    * Helper type to serialize/deserialize xml element non functional properties
 30    *
 31    * @author not attributable
 32    */
 33    class NodeNFP {
 34   
 35  0 static void serialize(Resource subject, Entity entity, WsmlRdfSerializer serializer) {
 36  0 if (entity.listNFPValues().isEmpty()) {
 37  0 return;
 38    }
 39  0 Map map = entity.listNFPValues();
 40  0 for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
 41  0 Map.Entry entry = (Map.Entry) i.next();
 42  0 URI comment = serializer.getFactory().createURI(entry.getKey().toString());
 43  0 Set dataValues = (Set) entry.getValue();
 44  0 for (Iterator j = dataValues.iterator(); j.hasNext();) {
 45  0 try {
 46  0 if(comment.getURI().equals(WsmlRdfSerializer.DC_RELATION)) {
 47  0 serializer.getWriter().writeComment(comment + ":" +
 48    NodeValue.serialize(j.next(), serializer));
 49    }
 50  0 else if (comment.getURI().equals(RDFS.LABEL)) {
 51  0 serializer.getWriter().writeStatement(
 52    subject, serializer.getFactory().createURI(RDFS.LABEL),
 53    NodeValue.serialize(j.next(), serializer));
 54    }
 55    else {
 56  0 serializer.getWriter().writeStatement(
 57    subject,
 58    comment,
 59    NodeValue.serialize(j.next(), serializer));
 60    }
 61    } catch(IOException e) {
 62  0 throw new RuntimeException(e);
 63    }
 64    }
 65    }
 66    }
 67   
 68  0 static void serialize(Ontology onto, WsmlRdfSerializer serializer) {
 69  0 if (onto.listNFPValues().isEmpty()) {
 70  0 return;
 71    }
 72   
 73  0 Map map = onto.listNFPValues();
 74  0 for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
 75  0 Map.Entry entry = (Map.Entry) i.next();
 76  0 String comment = entry.getKey().toString() + ":";
 77  0 Set dataValues = (Set) entry.getValue();
 78  0 for (Iterator j = dataValues.iterator(); j.hasNext();) {
 79  0 comment = comment + " " + NodeValue.serialize(j.next(), serializer);
 80    }
 81  0 try {
 82  0 serializer.getWriter().writeComment(comment);
 83    } catch(IOException e) {
 84  0 throw new RuntimeException(e);
 85    }
 86    }
 87    }
 88    }
 89   
 90    /*
 91    * $Log$
 92    * Revision 1.2 2006/11/16 14:35:09 ohamano
 93    * *** empty log message ***
 94    *
 95    * Revision 1.1 2006/11/10 15:02:59 ohamano
 96    * *** empty log message ***
 97    *
 98    * Revision 1.1 2006/11/10 10:08:42 ohamano
 99    * *** empty log message ***
 100    *
 101    *
 102    */