Examples of RDFXMLOntologyFormat


Examples of org.semanticweb.owlapi.io.RDFXMLOntologyFormat

        OWLOntologyFormat format = manager.getOntologyFormat(ontology);
      
        // We can save the ontology in a different format Lets save the ontology in owl/xml format
        OWLXMLOntologyFormat owlxmlFormat = new OWLXMLOntologyFormat();
        //or in the rdf/xml format
        RDFXMLOntologyFormat rdfxmlFormat = new RDFXMLOntologyFormat();
       
        // Some ontology formats support prefix names and prefix IRIs.  When we save the ontology in the new format we
        // will copy the prefixes over so that we have nicely abbreviated IRIs in the new ontology document
        if (format.isPrefixOWLOntologyFormat()) {
            owlxmlFormat.copyPrefixesFrom(format.asPrefixOWLOntologyFormat());
View Full Code Here

Examples of org.semanticweb.owlapi.io.RDFXMLOntologyFormat

    Set<OWLAxiom> module = ModularityUtils.extractModule( loader.getOntology(), entities, moduleType );

    try {
      OWLOntology moduleOnt = loader.getManager().createOntology( module );
      loader.getManager().saveOntology( moduleOnt, new RDFXMLOntologyFormat(),
          new SystemOutDocumentTarget() );
    } catch( OWLException e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here

Examples of org.semanticweb.owlapi.io.RDFXMLOntologyFormat

        additions.add(new AddAxiom(ont, __factory.getOWLDataPropertyAssertionAxiom(hasId, iSes, hasIdValue)));
        mgr.applyChanges(additions);

        StringDocumentTarget tgt = new StringDocumentTarget();
        try {
            mgr.saveOntology(ont, new RDFXMLOntologyFormat(), tgt);
            return ont;
        } catch (OWLOntologyStorageException e) {
            LoggerFactory.getLogger(ScopeSetRenderer.class).error(
                "KReS :: could not save session metadata ontology.", e);
            return null;
View Full Code Here

Examples of org.semanticweb.owlapi.io.RDFXMLOntologyFormat

    public static void printOntology(OWLOntology o, PrintStream printer) {

        OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
        StringDocumentTarget tgt = new StringDocumentTarget();
        try {
            mgr.saveOntology(o, new RDFXMLOntologyFormat(), tgt);
        } catch (OWLOntologyStorageException e) {
            e.printStackTrace(printer);
        }
        printer.println(tgt.toString());
View Full Code Here

Examples of org.semanticweb.owlapi.io.RDFXMLOntologyFormat

                OWLOntology refactoredDataSet = /* ontologyStorage */this.sparqlConstruct(sparql,
                    datasetURI.toString());

                ByteArrayOutputStream out = new ByteArrayOutputStream();
                try {
                    ontologyManager.saveOntology(refactoredDataSet, new RDFXMLOntologyFormat(), out);
                    if (refactoredOntologyIRI == null) {
                        ByteArrayOutputStream fpOut = new ByteArrayOutputStream();
                        fingerPrint += URIGenerator.createID("", fpOut.toByteArray());
                    }

View Full Code Here

Examples of org.semanticweb.owlapi.io.RDFXMLOntologyFormat

    private static synchronized void cacheOntology(URI physicalRemoteUri, File file, OWLOntology ont) throws UnknownOWLOntologyException,
                                                                                                     OWLOntologyStorageException {
        uris.put(physicalRemoteUri, file);
        oiri.put(physicalRemoteUri, ont.getOntologyID().getOntologyIRI());
        manager.setOntologyDocumentIRI(ont, IRI.create(file));
        manager.saveOntology(ont, new RDFXMLOntologyFormat(), IRI.create(file));
    }
View Full Code Here

Examples of org.semanticweb.owlapi.io.RDFXMLOntologyFormat

//            classExpressionIRIs.removeAll(dataRangeIRIs);

            IRIMap.clear();

            tripleProcessor.fine("Total number of triples: " + count);
            RDFXMLOntologyFormat format = ontologyFormat;


            consumeSWRLRules();


            // We need to mop up all remaining triples.  These triples will be in the
            // triples by subject map.  Other triples which reside in the triples by
            // predicate (single valued) triple aren't "root" triples for axioms.  First
            // we translate all system triples and then go for triples whose predicates
            // are not system/reserved vocabulary IRIs to translate these into ABox assertions
            // or annotationIRIs
            iterateResourceTriples(new ResourceTripleIterator<UnloadableImportException>() {
                public void handleResourceTriple(IRI subject, IRI predicate, IRI object) throws UnloadableImportException {
                    handle(subject, predicate, object);
                }
            });

            iterateLiteralTriples(new LiteralTripleIterator<UnloadableImportException>() {
                public void handleLiteralTriple(IRI subject, IRI predicate, OWLLiteral object) throws UnloadableImportException {
                    handle(subject, predicate, object);
                }
            });

            // Inverse property axioms
            inverseOfHandler.setAxiomParsingMode(true);
            iterateResourceTriples(new ResourceTripleIterator<UnloadableImportException>() {
                public void handleResourceTriple(IRI subject, IRI predicate, IRI object) throws UnloadableImportException {
                    if (inverseOfHandler.canHandle(subject, predicate, object)) {
                        inverseOfHandler.handleTriple(subject, predicate, object);
                    }
                }
            });


            // Now handle non-reserved predicate triples
            consumeNonReservedPredicateTriples();

            // Now axiom annotations
            consumeAnnotatedAxioms();

            final Set<RDFTriple> remainingTriples = getRemainingTriples();


            if (format != null) {
                RDFParserMetaData metaData = new RDFParserMetaData(RDFOntologyHeaderStatus.PARSED_ONE_HEADER, count, remainingTriples);
                format.setOntologyLoaderMetaData(metaData);
            }


            // Do we need to change the ontology IRI?
            IRI ontologyIRIToSet = chooseOntologyIRI();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.