Examples of AddAxiom


Examples of org.semanticweb.owlapi.model.AddAxiom

                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.AddAxiom

                .getOWLObjectPropertyAssertionAxiom(hasWife, john, mary);
        // We now need to add this assertion to our ontology. To do this, we
        // apply an ontology change to the ontology via the OWLOntologyManager.
        // First we create the change object that will tell the manager that we
        // want to add the axiom to the ontology
        AddAxiom addAxiom1 = new AddAxiom(ont, axiom1);
        // Now we apply the change using the manager.
        manager.applyChange(addAxiom1);
        // Now we want to add the other facts/assertions to the ontology John
        // hasSon Bill Get a refernece to the hasSon property
        OWLObjectProperty hasSon = factory.getOWLObjectProperty(IRI
                .create(ontologyIRI + "#hasSon"));
        // Create the assertion, John hasSon Bill
        OWLAxiom axiom2 = factory.getOWLObjectPropertyAssertionAxiom(hasSon,
                john, bill);
        // Apply the change
        manager.applyChange(new AddAxiom(ont, axiom2));
        // John hasDaughter Susan
        OWLObjectProperty hasDaughter = factory.getOWLObjectProperty(IRI
                .create(ontologyIRI + "#hasDaughter"));
        OWLAxiom axiom3 = factory.getOWLObjectPropertyAssertionAxiom(
                hasDaughter, john, susan);
        manager.applyChange(new AddAxiom(ont, axiom3));
        // John hasAge 33 In this case, hasAge is a data property, which we need
        // a reference to
        OWLDataProperty hasAge = factory.getOWLDataProperty(IRI
                .create(ontologyIRI + "#hasAge"));
        // We create a data property assertion instead of an object property
        // assertion
        OWLAxiom axiom4 = factory.getOWLDataPropertyAssertionAxiom(hasAge,
                john, 33);
        manager.applyChange(new AddAxiom(ont, axiom4));
        // In the above code, 33 is an integer, so we can just pass 33 into the
        // data factory method. Behind the scenes the OWL API will create a
        // typed constant that it will use as the value of the data property
        // assertion. We could have manually created the constant as follows:
        OWLDatatype intDatatype = factory.getIntegerOWLDatatype();
View Full Code Here

Examples of org.semanticweb.owlapi.model.AddAxiom

        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.AddAxiom

                df.getOWLLiteral("A class which represents Quokkas", "en"));
        // Specify that the pizza class has an annotation
        OWLAxiom ax = df.getOWLAnnotationAssertionAxiom(quokkaCls.getIRI(),
                commentAnno);
        // Add the axiom to the ontology
        m.applyChange(new AddAxiom(o, ax));
        // add a version info annotation to the ontology
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.AddAxiom

    }

    public OWLOntology createOntology() throws OWLOntologyCreationException {
        OWLOntology ontology = m.createOntology(IRI(NS));
        List<AddAxiom> changes = new ArrayList<>();
        changes.add(new AddAxiom(ontology, axiom));
        m.applyChanges(changes);
        return ontology;
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.AddAxiom

                        chgs.addAll(changes);
                    }
                });
        ont.getOWLOntologyManager().addAxiom(ont, ax);
        assertEquals(1, chgs.size());
        assertTrue(chgs.contains(new AddAxiom(ont, ax)));
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.AddAxiom

                        chgs.addAll(changes);
                    }
                });
        ont.getOWLOntologyManager().addAxioms(ont, singleton(ax));
        assertEquals(1, chgs.size());
        assertTrue(chgs.contains(new AddAxiom(ont, ax)));
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.AddAxiom

                    public void ontologiesChanged(
                            @Nonnull List<? extends OWLOntologyChange> changes) {
                        chgs.addAll(changes);
                    }
                });
        ont.getOWLOntologyManager().applyChange(new AddAxiom(ont, ax));
        assertEquals(1, chgs.size());
        assertTrue(chgs.contains(new AddAxiom(ont, ax)));
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.AddAxiom

                    public void ontologiesChanged(
                            @Nonnull List<? extends OWLOntologyChange> changes) {
                        chgs.addAll(changes);
                    }
                });
        ont.getOWLOntologyManager().applyChange(new AddAxiom(ont, ax));
        assertEquals(1, chgs.size());
        assertTrue(chgs.contains(new AddAxiom(ont, ax)));
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.AddAxiom

        OWLObjectProperty p = ObjectProperty(IRI("urn:test#p"));
        OWLDataProperty q = DataProperty(IRI("urn:test#q"));
        OWLIndividual i = AnonymousIndividual();
        OWLOntology ontology = m.createOntology();
        List<OWLOntologyChange> changes = new ArrayList<>();
        changes.add(new AddAxiom(ontology, SubClassOf(c, ObjectHasValue(p, i))));
        changes.add(new AddAxiom(ontology, ClassAssertion(d, i)));
        changes.add(new AddAxiom(ontology, DataPropertyAssertion(q, i,
                Literal("hello"))));
        m.applyChanges(changes);
        OWLOntology ontologyReloaded = loadOntologyFromString(saveOntology(ontology));
        equal(ontology, ontologyReloaded);
    }
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.