Clover coverage report - Maven Clover report
Coverage timestamp: Tue Sep 16 2008 01:16:37 EEST
file stats: LOC: 86   Methods: 1
NCLOC: 47   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NodeInstance.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.*;
 26    import org.wsmo.common.*;
 27   
 28    /**
 29    * Helper type to serialize/deserialize xml element instance
 30    *
 31    * @author not attributable
 32    */
 33    class NodeInstance {
 34   
 35  0 static void serialize(Instance instance, WsmlRdfSerializer serializer) {
 36  0 try {
 37  0 Resource inst = serializer.getFactory().createURI(instance.getIdentifier().toString());
 38   
 39  0 if (!instance.listConcepts().isEmpty()) {
 40  0 Object[] entities = instance.listConcepts().toArray();
 41  0 for (int i = 0; i < entities.length; i++) {
 42  0 serializer.getWriter().writeStatement(
 43    inst,
 44    serializer.getFactory().createURI(RDF.TYPE),
 45    serializer.getFactory().createURI(((Entity) entities[i])
 46    .getIdentifier().toString()));
 47    }
 48    } else {
 49  0 serializer.getWriter().writeStatement(
 50    inst,
 51    serializer.getFactory().createURI(RDF.TYPE),
 52    serializer.getFactory().createURI(RDFS.RESOURCE));
 53    }
 54  0 if (!instance.listNFPValues().isEmpty()) {
 55  0 NodeNFP.serialize(inst,instance, serializer);
 56    }
 57  0 if (!instance.listAttributeValues().isEmpty()) {
 58  0 for (Iterator i = instance.listAttributeValues().keySet().iterator(); i.hasNext();) {
 59  0 Identifier attrId = (Identifier)i.next();
 60  0 URI attrURI = serializer.getFactory().createURI(attrId.toString());
 61   
 62  0 Set datavalues = instance.listAttributeValues(attrId);
 63  0 for (Iterator j = datavalues.iterator(); j.hasNext();) {
 64  0 serializer.getWriter().writeStatement(
 65    inst,
 66    attrURI,
 67    NodeValue.serialize(j.next(), serializer));
 68    }
 69    }
 70    }
 71    } catch (IOException e) {
 72  0 throw new RuntimeException(e);
 73    }
 74    }
 75    }
 76   
 77    /*
 78    * $Log$
 79    * Revision 1.1 2006/11/10 15:02:59 ohamano
 80    * *** empty log message ***
 81    *
 82    * Revision 1.1 2006/11/10 10:08:42 ohamano
 83    * *** empty log message ***
 84    *
 85    *
 86    */