Package org.apache.stanbol.commons.owl

Examples of org.apache.stanbol.commons.owl.OntologyLookaheadMGraph


        long before = System.currentTimeMillis();
        log.info("Guessing ontology ID. Read limit = {} triples; offset = {} triples.", limit,
            versionIriOffset);
        BufferedInputStream bIn = new BufferedInputStream(content);
        bIn.mark(limit * 512); // set an appropriate limit
        OntologyLookaheadMGraph graph = new OntologyLookaheadMGraph(limit, versionIriOffset);
        try {
            parser.parse(graph, bIn, format);
        } catch (RuntimeException e) {
            log.error("Parsing failed for format {}. Returning null.", format);
        }
        OWLOntologyID result;

        if (graph.getOntologyIRI() == null) { // No Ontology ID found
            log.warn(" *** No ontology ID found, ontology has a chance of being anonymous.");
            result = new OWLOntologyID();
        } else {
            // bIn.reset(); // reset set the stream to the start
            IRI oiri = IRI.create(graph.getOntologyIRI().getUnicodeString());
            result = graph.getVersionIRI() == null ? new OWLOntologyID(oiri) : new OWLOntologyID(oiri,
                    IRI.create(graph.getVersionIRI().getUnicodeString()));
            log.info(" *** Guessed ID : {}", result);
        }
        log.info(" ... Triples scanned : {}; filtered in : {}", graph.getScannedTripleCount(), graph.size());
        log.info(" ... Time : {} ms", System.currentTimeMillis() - before);
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.commons.owl.OntologyLookaheadMGraph

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.