Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLNamedIndividual


    @Test
    public void testCorrectAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLClass clsA = Class(iri("A"));
        OWLNamedIndividual indA = NamedIndividual(iri("a"));
        OWLNamedIndividual indB = NamedIndividual(iri("b"));
        axioms.add(SubClassOf(clsA, ObjectOneOf(indA, indB)));
        assertEquals(getOnt().getAxioms(), axioms);
    }
View Full Code Here


    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLNamedIndividual indA = NamedIndividual(IRI("http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A"));
        OWLNamedIndividual indB = NamedIndividual(IRI("http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B"));
        OWLObjectProperty property = ObjectProperty(IRI("http://example.com/place/123"));
        axioms.add(ObjectPropertyAssertion(property, indA, indB));
        return axioms;
    }
View Full Code Here

    public void testRenameIndividual() {
        OWLOntology ont = getOWLOntology("testont");
        OWLClass clsA = Class(iri("ClsA"));
        OWLDataProperty propA = DataProperty(iri("propA"));
        OWLObjectProperty propB = ObjectProperty(iri("propB"));
        OWLNamedIndividual indA = NamedIndividual(iri("indA"));
        OWLNamedIndividual indB = NamedIndividual(iri("indA"));
        OWLAnnotationProperty annoProp = AnnotationProperty(iri("annoProp"));
        Set<OWLAxiom> axioms1 = new HashSet<>();
        axioms1.add(ClassAssertion(clsA, indA));
        axioms1.add(DataPropertyAssertion(propA, indA, Literal(33)));
        axioms1.add(NegativeDataPropertyAssertion(propA, indA, Literal(44)));
        axioms1.add(AnnotationAssertion(annoProp, propA.getIRI(), Literal("X")));
        axioms1.add(ObjectPropertyAssertion(propB, indA, indB));
        axioms1.add(NegativeObjectPropertyAssertion(propB, indA, indB));
        ont.getOWLOntologyManager().addAxioms(ont, axioms1);
        Set<OWLAxiom> axioms2 = new HashSet<>();
        axioms2.add(ClassAssertion(clsA, indB));
        axioms2.add(DataPropertyAssertion(propA, indB, Literal(33)));
        axioms2.add(NegativeDataPropertyAssertion(propA, indB, Literal(44)));
        axioms2.add(AnnotationAssertion(annoProp, propA.getIRI(), Literal("X")));
        axioms2.add(ObjectPropertyAssertion(propB, indB, indB));
        axioms2.add(NegativeObjectPropertyAssertion(propB, indB, indB));
        OWLEntityRenamer entityRenamer = new OWLEntityRenamer(
                ont.getOWLOntologyManager(), singleton(ont));
        List<OWLOntologyChange> changes = entityRenamer.changeIRI(indA,
                indB.getIRI());
        ont.getOWLOntologyManager().applyChanges(changes);
        assertEquals(ont.getAxioms(), axioms2);
        List<OWLOntologyChange> changes2 = entityRenamer.changeIRI(
                indB.getIRI(), indA.getIRI());
        ont.getOWLOntologyManager().applyChanges(changes2);
        assertEquals(ont.getAxioms(), axioms1);
    }
View Full Code Here

    }

    @Test
    public void testRenameAnnotationProperty() {
        OWLOntology ont = getOWLOntology("testont");
        OWLNamedIndividual indA = NamedIndividual(iri("indA"));
        OWLNamedIndividual indB = NamedIndividual(iri("indB"));
        OWLAnnotationProperty annoProp = AnnotationProperty(iri("annoProp"));
        OWLAnnotationProperty annoPropR = AnnotationProperty(iri("annoPropR"));
        OWLAnnotationProperty annoProp2 = AnnotationProperty(iri("annoProp2"));
        Set<OWLAxiom> axioms1 = new HashSet<>();
        axioms1.add(Declaration(annoProp));
        axioms1.add(AnnotationAssertion(annoProp, indA.getIRI(), indB.getIRI()));
        axioms1.add(SubAnnotationPropertyOf(annoProp, annoProp2));
        axioms1.add(AnnotationPropertyRange(annoProp, indA.getIRI()));
        axioms1.add(AnnotationPropertyDomain(annoProp, indA.getIRI()));
        ont.getOWLOntologyManager().addAxioms(ont, axioms1);
        Set<OWLAxiom> axioms2 = new HashSet<>();
        axioms2.add(Declaration(annoPropR));
        axioms2.add(AnnotationAssertion(annoPropR, indA.getIRI(), indB.getIRI()));
        axioms2.add(SubAnnotationPropertyOf(annoPropR, annoProp2));
        axioms2.add(AnnotationPropertyRange(annoPropR, indA.getIRI()));
        axioms2.add(AnnotationPropertyDomain(annoPropR, indA.getIRI()));
        OWLEntityRenamer entityRenamer = new OWLEntityRenamer(
                ont.getOWLOntologyManager(), singleton(ont));
View Full Code Here

        @Override
        public void handleTriple(IRI subject, IRI predicate, IRI object) {
            if (!isAnonymous(subject)) {
                Set<OWLAnnotation> annos = consumer.getPendingAnnotations();
                OWLNamedIndividual individual = df
                        .getOWLNamedIndividual(subject);
                addAxiom(df.getOWLDeclarationAxiom(individual, annos));
            }
            consumer.addOWLNamedIndividual(subject, true);
        }
View Full Code Here

        Set<OWLNamedIndividual> inds = new HashSet<>();
        Set<OWLSameIndividualAxiom> processed = new HashSet<>();
        List<OWLNamedIndividual> stack = new LinkedList<>();
        stack.add(ind);
        while (!stack.isEmpty()) {
            OWLNamedIndividual currentInd = stack.remove(0);
            assert currentInd != null;
            for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
                for (OWLSameIndividualAxiom axiom : ontology
                        .getSameIndividualAxioms(currentInd)) {
                    if (!processed.contains(axiom)) {
                        processed.add(axiom);
                        for (OWLIndividual i : axiom.getIndividuals()) {
                            if (!i.isAnonymous()) {
                                OWLNamedIndividual namedInd = i
                                        .asOWLNamedIndividual();
                                if (inds.add(namedInd)) {
                                    stack.add(namedInd);
                                }
                            }
View Full Code Here

        Set<OWLNamedIndividual> inds = new HashSet<>();
        Set<OWLDifferentIndividualsAxiom> processed = new HashSet<>();
        List<OWLNamedIndividual> stack = new LinkedList<>();
        stack.add(ind);
        while (!stack.isEmpty()) {
            OWLNamedIndividual currentInd = stack.remove(0);
            assert currentInd != null;
            for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
                for (OWLDifferentIndividualsAxiom axiom : ontology
                        .getDifferentIndividualAxioms(currentInd)) {
                    if (!processed.contains(axiom)) {
                        processed.add(axiom);
                        for (OWLIndividual i : axiom.getIndividuals()) {
                            if (!i.isAnonymous()) {
                                OWLNamedIndividual namedInd = i
                                        .asOWLNamedIndividual();
                                if (inds.add(namedInd)) {
                                    stack.add(namedInd);
                                }
                            }
View Full Code Here

    @Tests(method = "public Object visit(OWLClassAssertionAxiom axiom)")
    public void shouldCreateViolationForOWLClassAssertionAxiomInOWL2QLProfile()
            throws Exception {
        OWLOntology o = createOnto();
        OWLOntologyManager m = o.getOWLOntologyManager();
        OWLNamedIndividual i = NamedIndividual(IRI("urn:test#i"));
        declare(o, OP, i);
        m.addAxiom(o, ClassAssertion(ObjectSomeValuesFrom(OP, OWLThing()), i));
        OWL2QLProfile profile = new OWL2QLProfile();
        int expected = 1;
        Class[] expectedViolations = { UseOfNonAtomicClassExpression.class };
View Full Code Here

            shouldCreateViolationForOWLNegativeObjectPropertyAssertionAxiomInOWL2QLProfile()
                    throws Exception {
        OWLOntology o = createOnto();
        OWLOntologyManager m = o.getOWLOntologyManager();
        declare(o, OP);
        OWLNamedIndividual i = NamedIndividual(IRI("urn:test#i"));
        OWLNamedIndividual i1 = NamedIndividual(IRI("urn:test#i"));
        declare(o, i, i1);
        m.addAxiom(o, NegativeObjectPropertyAssertion(OP, i, i1));
        OWL2QLProfile profile = new OWL2QLProfile();
        int expected = 1;
        Class[] expectedViolations = { UseOfIllegalAxiom.class };
View Full Code Here

            shouldCreateViolationForOWLNegativeDataPropertyAssertionAxiomInOWL2QLProfile()
                    throws Exception {
        OWLOntology o = createOnto();
        OWLOntologyManager m = o.getOWLOntologyManager();
        declare(o, DATAP);
        OWLNamedIndividual i = NamedIndividual(IRI("urn:test#i"));
        declare(o, i);
        m.addAxiom(o, NegativeDataPropertyAssertion(DATAP, i, Literal(1)));
        OWL2QLProfile profile = new OWL2QLProfile();
        int expected = 1;
        Class[] expectedViolations = { UseOfIllegalAxiom.class };
View Full Code Here

TOP

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

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.