Examples of OWLClassAssertionAxiom


Examples of org.semanticweb.owl.model.OWLClassAssertionAxiom

        List<OWLClass> classes = new Vector<OWLClass>(vManager.getConceptSet());
       
        List<OWLAxiomChange> toAdd = new Vector<OWLAxiomChange>();
        for (int i = 0; i < instances; i++) {
          int rnd = m_random.nextInt(classes.size());
          OWLClassAssertionAxiom newAxiom = factory.getOWLClassAssertionAxiom(newIndividual(factory), classes.get(rnd));
          toAdd.add(new AddAxiom(ontology,newAxiom))
          System.out.println((i+1)+"- new axiom: "+newAxiom.toString());
        }       
        manager.applyChanges(toAdd);
        OutputStreamWriter sw = new FileWriter(new File(outputFile));
        OWLOntologyOutputTarget target = new WriterOutputTarget(sw);
        manager.saveOntology(ontology, target);
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLClassAssertionAxiom

    }

    @Test
    public void shouldBuildClassAssertion() {
        // given
        OWLClassAssertionAxiom expected = df.getOWLClassAssertionAxiom(ce, i,
                annotations);
        BuilderClassAssertion builder = new BuilderClassAssertion(expected, df);
        // when
        OWLObject built = builder.buildObject();
        // then
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLClassAssertionAxiom

    public boolean equals(Object obj) {
        if (super.equals(obj)) {
            if (!(obj instanceof OWLClassAssertionAxiom)) {
                return false;
            }
            OWLClassAssertionAxiom other = (OWLClassAssertionAxiom) obj;
            return other.getIndividual().equals(individual)
                    && other.getClassExpression().equals(classExpression);
        }
        return false;
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLClassAssertionAxiom

        return AxiomType.CLASS_ASSERTION;
    }

    @Override
    protected int compareObjectOfSameType(OWLObject object) {
        OWLClassAssertionAxiom otherAx = (OWLClassAssertionAxiom) object;
        int diff = getIndividual().compareTo(otherAx.getIndividual());
        if (diff != 0) {
            return diff;
        } else {
            return getClassExpression().compareTo(otherAx.getClassExpression());
        }
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLClassAssertionAxiom

        AddAxiom addAxiomChange = new AddAxiom(o, assertion);
        m.applyChange(addAxiomChange);
        // matthew is an instance of Person
        OWLClass personClass = df.getOWLClass(IRI.create(EXAMPLE_IRI
                + "#Person"));
        OWLClassAssertionAxiom ax = df.getOWLClassAssertionAxiom(personClass,
                matthew);
        // Add this axiom to our ontology - with a convenience method
        m.addAxiom(o, ax);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLClassAssertionAxiom

        PrefixManager pm = new DefaultPrefixManager(null, null, base);
        OWLClass person = df.getOWLClass(":Person", pm);
        OWLNamedIndividual mary = df.getOWLNamedIndividual(":Mary", pm);
        // create a ClassAssertion to specify that :Mary is an instance of
        // :Person
        OWLClassAssertionAxiom classAssertion = df.getOWLClassAssertionAxiom(
                person, mary);
        OWLOntology o = m.createOntology(IRI.create(base));
        // Add the class assertion
        m.addAxiom(o, classAssertion);
        // Dump the ontology
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLClassAssertionAxiom

        // <http://example.com/owl/families/Mary>)
        OWLNamedIndividual mary = dataFactory
                .getOWLNamedIndividual(":Mary", pm);
        // Now create a ClassAssertion to specify that :Mary is an instance of
        // :Person
        OWLClassAssertionAxiom classAssertion = dataFactory
                .getOWLClassAssertionAxiom(person, mary);
        // We need to add the class assertion to the ontology that we want
        // specify that :Mary is a :Person
        OWLOntology ontology = manager.createOntology(IRI.create(base));
        // Add the class assertion
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLClassAssertionAxiom

        // person class
        OWLClass personClass = dataFactory.getOWLClass(IRI.create(base
                + "#Person"));
        // Now we will create out Class Assertion to specify that matthew is an
        // instance of Person (or rather that Person has matthew as an instance)
        OWLClassAssertionAxiom ax = dataFactory.getOWLClassAssertionAxiom(
                personClass, matthew);
        // Add this axiom to our ontology. We can use a short cut method -
        // instead of creating the AddAxiom change ourselves, it will be created
        // automatically and the change applied
        man.addAxiom(ont, ax);
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLClassAssertionAxiom

        // Now add all of our domain and range axioms
        manager.addAxioms(ont, domainsAndRanges);
        // Class assertion axioms //We can also explicitly say than an
        // individual is an instance of a given class. To do this we use a Class
        // assertion axiom.
        OWLClassAssertionAxiom classAssertionAx = factory
                .getOWLClassAssertionAxiom(person, john);
        // Add the axiom directly using the addAxiom convenience method on
        // OWLOntologyManager
        manager.addAxiom(ont, classAssertionAx);
        // Inverse property axioms //We can specify the inverse property of
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLClassAssertionAxiom

    public void testClassAssertionAxiomAccessors() {
        OWLOntology ont = getOWLOntology("ont");
        OWLClass clsA = Class(iri("clsA"));
        OWLNamedIndividual indA = NamedIndividual(iri("indA"));
        OWLOntologyManager man = ont.getOWLOntologyManager();
        OWLClassAssertionAxiom ax = ClassAssertion(clsA, indA);
        man.addAxiom(ont, ax);
        performAxiomTests(ont, ax);
        assertTrue(ont.getClassAssertionAxioms(indA).contains(ax));
        assertTrue(ont.getClassAssertionAxioms(clsA).contains(ax));
        assertTrue(ont.getAxioms(indA, EXCLUDED).contains(ax));
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.