Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.IRI


            OWLClassExpression superClass = axiom.getSuperClass();
            if (superClass instanceof OWLObjectExactCardinality) {
                OWLObjectExactCardinality cardinality = (OWLObjectExactCardinality) superClass;
                OWLClassExpression filler = cardinality.getFiller();
                assertFalse(filler.isAnonymous());
                IRI iri = filler.asOWLClass().getIRI();
                if (iri.equals(bridge.oboIdToIRI("PR:000005116"))) {
                    foundRel1 = true;
                    assertEquals(1, cardinality.getCardinality());
                } else if (iri.equals(bridge.oboIdToIRI("PR:000027122"))) {
                    foundRel2 = true;
                    assertEquals(2, cardinality.getCardinality());
                }
            }
        }
View Full Code Here


    @Test
    public void testConvert() {
        OWLOntology owlOnt = convertOBOFile("version_iri_test.obo");
        assertNotNull(owlOnt);
        IRI v = owlOnt.getOntologyID().getVersionIRI().get();
        assertEquals("http://purl.obolibrary.org/obo/go/2012-01-01/go.owl",
                v.toString());
    }
View Full Code Here

        // check round trip
        OBODoc output = convert(owl);
        String outObo = renderOboToString(output);
        assertEquals(readResource("is_inferred_annotation.obo"), outObo);
        // check owl
        IRI t1 = IRI.create("http://purl.obolibrary.org/obo/TEST_0001");
        IRI t3 = IRI.create("http://purl.obolibrary.org/obo/TEST_0003");
        IRI isInferredIRI = IRI.create(Obo2OWLConstants.OIOVOCAB_IRI_PREFIX,
                "is_inferred");
        boolean hasAnnotation = false;
        Set<OWLSubClassOfAxiom> axioms = owl.getAxioms(AxiomType.SUBCLASS_OF);
        for (OWLSubClassOfAxiom axiom : axioms) {
            OWLClassExpression superClassCE = axiom.getSuperClass();
View Full Code Here

    @Test
    public void testConvert() {
        // PARSE TEST FILE, CONVERT TO OWL
        OWLOntology ontology = convert(parseOBOFile("relation_shorthand_test.obo"));
        // TEST CONTENTS OF OWL ONTOLOGY
        IRI regulatesIRI = getIriByLabel(ontology, "regulates");
        assertNotNull(regulatesIRI);
        boolean ok = false;
        // test that transitive over is translated to a property chain
        Set<OWLSubPropertyChainOfAxiom> axioms = ontology
                .getAxioms(AxiomType.SUB_PROPERTY_CHAIN_OF);
        for (OWLSubPropertyChainOfAxiom axiom : axioms) {
            OWLObjectProperty p = (OWLObjectProperty) axiom.getSuperProperty();
            if (regulatesIRI.equals(p.getIRI())) {
                List<OWLObjectPropertyExpression> chain = axiom
                        .getPropertyChain();
                assertEquals(2, chain.size());
                assertEquals(p, chain.get(0));
                assertEquals("http://purl.obolibrary.org/obo/BFO_0000050",
View Full Code Here

                OWLManager.createOWLOntologyManager());
        OWLOntology owlOntology = bridge.convert(oboDocSource);
        OWLDataFactory factory = owlOntology.getOWLOntologyManager()
                .getOWLDataFactory();
        // IRI
        IRI iri = bridge.oboIdToIRI("CARO:0000049");
        OWLClass c = factory.getOWLClass(iri);
        // Def
        OWLAnnotationProperty defProperty = factory
                .getOWLAnnotationProperty(Obo2OWLVocabulary.IRI_IAO_0000115
                        .getIRI());
View Full Code Here

            parseOntologyHeader(boolean toEOF) {
        String tok = consumeToken();
        if (!ONTOLOGY.matches(tok)) {
            throw new ExceptionBuilder().withKeyword(ONTOLOGY).build();
        }
        IRI ontologyIRI = null;
        IRI versionIRI = null;
        if (peekToken().startsWith("<")) {
            ontologyIRI = parseIRI();
            if (peekToken().startsWith("<")) {
                versionIRI = parseIRI();
            }
        }
        Set<OWLAnnotation> annotations = new HashSet<>();
        Set<OWLImportsDeclaration> imports = new HashSet<>();
        while (true) {
            String section = peekToken();
            if (IMPORT.matches(section)) {
                consumeToken();
                tok = peekToken();
                Optional<IRI> importedIRI = Optional.absent();
                if (tok.startsWith("<")) {
                    importedIRI = Optional.of(parseIRI());
                } else if (isOntologyName(tok)) {
                    consumeToken();
                    OWLOntology ont = getOntology(tok);
                    if (ont != null) {
                        importedIRI = ont.getOntologyID().getOntologyIRI();
                    }
                } else {
                    consumeToken();
                    throw new ExceptionBuilder().withOnto()
                            .withKeyword("<$ONTOLOGYYURI$>").build();
                }
                if (!importedIRI.isPresent()) {
                    throw new ExceptionBuilder().withOnto()
                            .withKeyword("Imported IRI is null").build();
                }
                IRI importedOntologyIRI = importedIRI.get();
                assert importedOntologyIRI != null;
                imports.add(dataFactory
                        .getOWLImportsDeclaration(importedOntologyIRI));
            } else if (ANNOTATIONS.matches(section)) {
                consumeToken();
View Full Code Here

        boolean fullIRI = name.equals("<");
        if (fullIRI) {
            name = consumeToken();
            consumeToken();
        }
        IRI uri = nameIRIMap.get(name);
        if (uri != null) {
            return uri;
        }
        if (fullIRI) {
            uri = IRI.create(name);
View Full Code Here

        }
        string2IRI = new HashMap<String, IRI>();
    }

    public IRI getIRI(String s) {
        IRI iri = string2IRI.get(s);
        if (iri == null) {
            if (s.charAt(0) == '<') {
                iri = IRI.create(s.substring(1, s.length() - 1));
            } else {
                int colonIndex = s.indexOf(':');
View Full Code Here

            UnloadableImportException {
        OWLAnnotation anno;
        OWLAxiom ax;
        OWLImportsDeclaration decl;
        int count = 0;
        IRI versionIRI = null;
        jj_consume_token(ONTOLOGY);
        jj_consume_token(OPENPAR);
        switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
            case FULLIRI:
            case PNAME_LN: {
View Full Code Here

        jj_consume_token(CLOSEPAR);
    }

    final public void Prefix() throws ParseException {
        String prefixName = "";
        IRI iri;
        jj_consume_token(PREFIX);
        jj_consume_token(OPENPAR);
        prefixName = PrefixName();
        jj_consume_token(EQUALS);
        iri = FullIRI();
        jj_consume_token(CLOSEPAR);
        prefixMap.put(prefixName, iri.toString());
    }
View Full Code Here

TOP

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

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.