Package org.coode.owl.rdfxml.parser

Examples of org.coode.owl.rdfxml.parser.OWLRDFConsumer$FakeSet


  private static OWLOntology convert(RDFModel model, OWLOntologyManager manager)
      throws OWLOntologyCreationException, SAXException {
    OWLOntology ontology = manager.createOntology( TMP_URI );

    OWLRDFConsumer consumer = new OWLRDFConsumer( manager, ontology,
        new AnonymousNodeChecker() {
          public boolean isAnonymousNode(URI uri) {
            return isAnonymousNode( uri.toString() );
          }

          public boolean isAnonymousNode(String uri) {
            return uri.startsWith( ANON_URI );
          }
        } );

    consumer.startModel( "" );

    for( Statement stmt : model.getStatements() ) {
      String subj = toString( stmt.getSubject() );
      String pred = toString( stmt.getPredicate() );
      RDFNode vObj = stmt.getObject();
      String obj = toString( vObj );

      if( vObj instanceof Literal ) {
        Literal literal = (Literal) vObj;

        String datatypeURI = literal.getDatatypeURI();
        String lang = literal.getLanguage();
       
        if( lang != null && lang.length() == 0 )
          lang = null;

        consumer.statementWithLiteralValue( subj, pred, obj, lang, datatypeURI );
      }
      else {
        consumer.statementWithResourceValue( subj, pred, obj );
      }
    }

    consumer.endModel();

    return ontology;
  }
View Full Code Here

TOP

Related Classes of org.coode.owl.rdfxml.parser.OWLRDFConsumer$FakeSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.