Examples of OWLSubClassOfAxiom


Examples of org.semanticweb.owlapi.model.OWLSubClassOfAxiom

        String sep = COMMA.keyword();
        while (COMMA.matches(sep)) {
            String clsName = consumeToken();
            OWLClass cls = getOWLClass(clsName);
            siblings.add(cls);
            OWLSubClassOfAxiom ax = dataFactory.getOWLSubClassOfAxiom(cls,
                    superclass);
            for (OWLOntology ont : onts) {
                assert ont != null;
                axioms.add(new OntologyAxiomPair(ont, ax));
            }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLSubClassOfAxiom

        // least one part that is a kind of nose
        OWLClassExpression hasPartSomeNose = df.getOWLObjectSomeValuesFrom(
                hasPart, nose);
        OWLClass head = df.getOWLClass(IRI.create(EXAMPLE_IRI + "#Head"));
        // Head subclass of our restriction
        OWLSubClassOfAxiom ax = df.getOWLSubClassOfAxiom(head, hasPartSomeNose);
        // Add the axiom to our ontology
        AddAxiom addAx = new AddAxiom(o, ax);
        m.applyChange(addAx);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLSubClassOfAxiom

                df.getOWLLiteral(18));
        // Now we can use this in our datatype restriction on hasAge
        OWLClassExpression adultDefinition = df.getOWLDataSomeValuesFrom(
                hasAge, greaterThan18);
        OWLClass adult = df.getOWLClass(IRI.create(EXAMPLE_IRI + "#Adult"));
        OWLSubClassOfAxiom ax = df
                .getOWLSubClassOfAxiom(adult, adultDefinition);
        m.applyChange(new AddAxiom(o, ax));
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLSubClassOfAxiom

    public void testParsedAxioms() throws OWLOntologyCreationException {
        OWLOntology ontology = createOntology();
        Set<OWLSubClassOfAxiom> axioms = ontology
                .getAxioms(AxiomType.SUBCLASS_OF);
        assertEquals(1, axioms.size());
        OWLSubClassOfAxiom ax = axioms.iterator().next();
        OWLClass subCls = Class(SUBCLASS_IRI);
        OWLClass supCls = Class(SUPERCLASS_IRI);
        assertEquals(subCls, ax.getSubClass());
        assertEquals(supCls, ax.getSuperClass());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLSubClassOfAxiom

    @Test
    public void testOntologyChangeListener() {
        OWLOntology ont = getOWLOntology("ont");
        OWLClass clsA = Class(iri("ClsA"));
        OWLClass clsB = Class(iri("ClsB"));
        OWLSubClassOfAxiom ax = SubClassOf(clsA, clsB);
        final Set<OWLAxiom> impendingAdditions = new HashSet<>();
        final Set<OWLAxiom> impendingRemovals = new HashSet<>();
        final Set<OWLAxiom> additions = new HashSet<>();
        final Set<OWLAxiom> removals = new HashSet<>();
        ont.getOWLOntologyManager().addImpendingOntologyChangeListener(
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLSubClassOfAxiom

    }

    @Test
    public void shouldBuildSubClass() {
        // given
        OWLSubClassOfAxiom expected = df.getOWLSubClassOfAxiom(ce,
                df.getOWLThing(), annotations);
        BuilderSubClass builder = new BuilderSubClass(expected, df);
        // when
        OWLObject built = builder.buildObject();
        // then
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLSubClassOfAxiom

        OWLOntology ont = getOWLOntology("ont");
        OWLClass clsA = Class(iri("A"));
        OWLClass clsB = Class(iri("B"));
        OWLObjectProperty prop = ObjectProperty(iri("prop"));
        OWLOntologyManager man = ont.getOWLOntologyManager();
        OWLSubClassOfAxiom ax = SubClassOf(clsA, clsB);
        man.addAxiom(ont, ax);
        OWLSubClassOfAxiom ax2 = SubClassOf(clsA,
                ObjectSomeValuesFrom(prop, clsB));
        man.addAxiom(ont, ax2);
        performAxiomTests(ont, ax, ax2);
        assertTrue(ont.getSubClassAxiomsForSubClass(clsA).contains(ax));
        assertTrue(ont.getSubClassAxiomsForSuperClass(clsB).contains(ax));
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLSubClassOfAxiom

        public Collection<OWLClass> getChildren(OWLClass parent) {
            Collection<OWLClass> result = new HashSet<>();
            for (OWLAxiom ax : getRootOntology().getReferencingAxioms(parent,
                    INCLUDED)) {
                if (ax instanceof OWLSubClassOfAxiom) {
                    OWLSubClassOfAxiom sca = (OWLSubClassOfAxiom) ax;
                    if (!sca.getSubClass().isAnonymous()) {
                        Set<OWLClassExpression> conjuncts = sca.getSuperClass()
                                .asConjunctSet();
                        if (conjuncts.contains(parent)) {
                            result.add(sca.getSubClass().asOWLClass());
                        }
                    }
                } else if (ax instanceof OWLEquivalentClassesAxiom) {
                    OWLEquivalentClassesAxiom eca = (OWLEquivalentClassesAxiom) ax;
                    for (OWLClassExpression ce : eca.getClassExpressions()) {
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLSubClassOfAxiom

        OWLClass display = Class(IRI("urn:test#display"));
        OWLOntology ontology = m
                .createOntology(IRI("http://protege.org/ontologies"));
        OWLObjectSomeValuesFrom r = df.getOWLObjectSomeValuesFrom(prop,
                df.getOWLObjectUnionOf(led, crt));
        OWLSubClassOfAxiom axiom = df.getOWLSubClassOfAxiom(display, r);
        m.addAxiom(ontology, axiom);
        StringDocumentTarget target = saveOntology(ontology,
                new ManchesterSyntaxDocumentFormat());
        assertFalse(target.toString().contains(
                "((<urn:test#crt> or <urn:test#led>))"));
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLSubClassOfAxiom

    public void shouldParse() throws Exception {
        OWLOntology o = m.createOntology(IRI.create("urn:test"));
        OWLClass c = df.getOWLClass(IRI.create("urn:c"));
        OWLObjectProperty p = df.getOWLObjectProperty(IRI.create("urn:p"));
        OWLAnonymousIndividual i = df.getOWLAnonymousIndividual();
        OWLSubClassOfAxiom sub = df.getOWLSubClassOfAxiom(c,
                df.getOWLObjectHasValue(p, i));
        o.getOWLOntologyManager().addAxiom(o, sub);
        OWLOntology roundtrip = roundTrip(o, new OWLXMLDocumentFormat());
        equal(o, roundtrip);
    }
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.