Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLOntologyID


public class OntologyIRITestCase extends AbstractFileTestCase {

    @Test
    public void testCorrectOntologyIRI() throws OWLOntologyCreationException {
        OWLOntology ont = createOntology();
        OWLOntologyID id = ont.getOntologyID();
        assertEquals("http://www.test.com/right.owl", id.getOntologyIRI().get()
                .toString());
    }
View Full Code Here


    public void handle(String id, String value) {
        // Set the base to be the default base + default prefix
        String uri = OBOVocabulary.ONTOLOGY_URI_BASE + "/" + value.toLowerCase();
        getConsumer().setDefaultNamespace(uri + "#");
        applyChange(new SetOntologyID(getOntology(), new OWLOntologyID(IRI.create(uri))));
    }
View Full Code Here

    public ManchesterOWLSyntaxOntologyHeader(IRI ontologyIRI,
                                             IRI versionIRI,
                                             Set<OWLAnnotation> annotations,
                                             Set<OWLImportsDeclaration> importsDeclarations) {
        this.ontologyID = new OWLOntologyID(ontologyIRI, versionIRI);
        this.annotations = new HashSet<OWLAnnotation>(annotations);
        this.importsDeclarations = new HashSet<OWLImportsDeclaration>(importsDeclarations);
    }
View Full Code Here

                Resource obj = it.next().getObject();
                if (obj instanceof UriRef) s = ((UriRef) obj);
                else if (obj instanceof TypedLiteral) s = lf.createObject(UriRef.class, (TypedLiteral) obj);
                viri = IRI.create(s.getUnicodeString());
            }
            if (viri == null) return new OWLOntologyID(oiri);
            else return new OWLOntologyID(oiri, viri);
        }
View Full Code Here

        String location = "/owl/named.owl";
        log.info("Testing lookahead for location {}", location);

        // Try a low triple limit (the ontology IRI triple is much further).
        InputStream content = getClass().getResourceAsStream(location);
        OWLOntologyID id = OWLUtils.guessOntologyID(content, parser, RDF_XML, 10);
        assertTrue(id.isAnonymous());

        // Try again with no limit
        content = getClass().getResourceAsStream(location);
        id = OWLUtils.guessOntologyID(content, parser, RDF_XML);
        assertNotNull(id);
        assertFalse(id.isAnonymous());
        assertEquals(new OWLOntologyID(ontologyIri), id);
    }
View Full Code Here

        String location = "/owl/named_immediate.owl";
        log.info("Testing lookahead for location {}", location);

        // Try a low triple limit (the ontology IRI triple is much further).
        InputStream content = getClass().getResourceAsStream(location);
        OWLOntologyID id = OWLUtils.guessOntologyID(content, parser, RDF_XML, 10);
        assertNotNull(id);
        assertEquals(new OWLOntologyID(ontologyIri), id);
    }
View Full Code Here

        // Minimum offset required is 2 because of an owl:versionInfo triple in-between.
        String location = "/owl/versioned.owl";
        log.info("Testing lookahead for location {}", location);
        IRI incubatedVersion = IRI
                .create("http://svn.apache.org/repos/asf/incubator/stanbol/trunk/commons/owl/src/test/resources/owl/versioned.owl");
        OWLOntologyID expectedOntId = new OWLOntologyID(ontologyIri, incubatedVersion);

        // Low triple limit: guessing should fail.
        InputStream content = getClass().getResourceAsStream(location);
        OWLOntologyID id = OWLUtils.guessOntologyID(content, parser, RDF_XML, 10);
        assertTrue(id.isAnonymous());

        // Reasonable triple limit with low offset: guessing should return the unversioned ID.
        content = getClass().getResourceAsStream(location);
        id = OWLUtils.guessOntologyID(content, parser, RDF_XML, 256, 1);
        assertNotNull(id);
        assertFalse(id.isAnonymous());
        assertEquals(new OWLOntologyID(ontologyIri), id);

        // Reasonable triple limit with auto offset: guessing should succeed.
        content = getClass().getResourceAsStream(location);
        id = OWLUtils.guessOntologyID(content, parser, RDF_XML, 256);
        assertNotNull(id);
        assertFalse(id.isAnonymous());
        assertEquals(expectedOntId, id);

        // No triple limit: guessing should succeed.
        content = getClass().getResourceAsStream(location);
        id = OWLUtils.guessOntologyID(content, parser, RDF_XML);
        assertNotNull(id);
        assertFalse(id.isAnonymous());
        assertEquals(expectedOntId, id);
    }
View Full Code Here

        // Actual distance is 102
        String location = "/owl/versioned_distance-100.owl";
        log.info("Testing lookahead for location {}", location);
        IRI incubatedVersion = IRI
                .create("http://svn.apache.org/repos/asf/incubator/stanbol/trunk/commons/owl/src/test/resources/owl/versioned_distance-100.owl");
        OWLOntologyID expectedOntId = new OWLOntologyID(ontologyIri, incubatedVersion);

        // No triple limit but offset < 102 : guessing should return the unversioned ID.
        InputStream content = getClass().getResourceAsStream(location);
        OWLOntologyID id = OWLUtils.guessOntologyID(content, parser, TURTLE, -1, 99);
        assertNotNull(id);
        assertEquals(new OWLOntologyID(ontologyIri), id);

        // Try again, setting limit = 1024 (offset = 102) should work.
        content = getClass().getResourceAsStream(location);
        id = OWLUtils.guessOntologyID(content, parser, TURTLE, 1024);
        assertNotNull(id);
View Full Code Here

        // Actual distance is 102
        String location = "/owl/versioned_distance-100-reversed.owl";
        log.info("Testing lookahead for location {}", location);
        IRI incubatedVersion = IRI
                .create("http://svn.apache.org/repos/asf/incubator/stanbol/trunk/commons/owl/src/test/resources/owl/versioned_distance-100-reversed.owl");
        OWLOntologyID expectedOntId = new OWLOntologyID(ontologyIri, incubatedVersion);

        // No triple limit but offset < 102 : guessing should fail.
        InputStream content = getClass().getResourceAsStream(location);
        OWLOntologyID id = OWLUtils.guessOntologyID(content, parser, TURTLE, -1, 99);
        assertTrue(id.isAnonymous());

        // Try again, setting limit = 1024 (offset = 102) should work.
        content = getClass().getResourceAsStream(location);
        id = OWLUtils.guessOntologyID(content, parser, TURTLE, 1024);
        assertNotNull(id);
        assertFalse(id.isAnonymous());
        assertEquals(expectedOntId, id);
    }
View Full Code Here

    public void lookaheadVersionedImmediate() throws Exception {
        String location = "/owl/versioned_immediate.owl";
        log.info("Testing lookahead for location {}", location);
        IRI incubatedVersion = IRI
                .create("http://svn.apache.org/repos/asf/incubator/stanbol/trunk/commons/owl/src/test/resources/owl/versioned_immediate.owl");
        OWLOntologyID expectedOntId = new OWLOntologyID(ontologyIri, incubatedVersion);

        // Try a low triple limit (the ontology IRI triple is much further).
        InputStream content = getClass().getResourceAsStream(location);
        OWLOntologyID id = OWLUtils.guessOntologyID(content, parser, RDF_XML, 10);
        assertNotNull(id);
        assertEquals(expectedOntId, id);
    }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.OWLOntologyID

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.