Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLAxiom


@SuppressWarnings("javadoc")
public class OntologyContainsAxiomTestCase extends TestBase {

    @Test
    public void testOntologyContainsPlainAxiom() {
        OWLAxiom axiom = SubClassOf(Class(iri("A")), Class(iri("B")));
        OWLOntology ont = getOWLOntology("testont");
        ont.getOWLOntologyManager().addAxiom(ont, axiom);
        assertTrue(ont.containsAxiom(axiom));
        assertTrue(ont.containsAxiom(axiom, EXCLUDED, IGNORE_AXIOM_ANNOTATIONS));
    }
View Full Code Here


    @Test
    public void testOntologyContainsAnnotatedAxiom() {
        OWLLiteral annoLiteral = Literal("value");
        OWLAnnotationProperty annoProp = AnnotationProperty(iri("annoProp"));
        OWLAnnotation anno = Annotation(annoProp, annoLiteral);
        OWLAxiom axiom = SubClassOf(Class(iri("A")), Class(iri("B")),
                singleton(anno));
        OWLOntology ont = getOWLOntology("testont");
        ont.getOWLOntologyManager().addAxiom(ont, axiom);
        assertTrue(ont.containsAxiom(axiom));
        assertTrue(ont.containsAxiom(axiom, EXCLUDED, IGNORE_AXIOM_ANNOTATIONS));
        assertFalse(ont.containsAxiom(axiom.getAxiomWithoutAnnotations()));
        assertTrue(ont.containsAxiom(axiom.getAxiomWithoutAnnotations(),
                EXCLUDED, IGNORE_AXIOM_ANNOTATIONS));
    }
View Full Code Here

        IRI ont2iri = ont2.getOntologyID().getOntologyIRI().get();
        OWLImportsDeclaration ont2import = ImportsDeclaration(ont1iri);
        ont1.getOWLOntologyManager().applyChange(
                new AddImport(ont2, ont2import));
        OWLAnnotationProperty annoProp = AnnotationProperty(iri("annoProp"));
        OWLAxiom axannoPropdecl = Declaration(annoProp);
        ont1.getOWLOntologyManager().addAxiom(ont1, axannoPropdecl);
        OWLAnnotation inont1anno = Annotation(annoProp, ont1iri);
        OWLAnnotation inont2anno = Annotation(annoProp, ont2iri);
        OWLClass a = Class(iri("A"));
        OWLAxiom axAdecl = Declaration(a, singleton(inont1anno));
        ont1.getOWLOntologyManager().addAxiom(ont1, axAdecl);
        OWLClass b = Class(iri("B"));
        OWLAxiom axBdecl = Declaration(b, singleton(inont2anno));
        ont2.getOWLOntologyManager().addAxiom(ont2, axBdecl);
        OWLAxiom axAsubB = SubClassOf(Class(iri("A")), Class(iri("B")),
                singleton(inont2anno));
        ont2.getOWLOntologyManager().addAxiom(ont2, axAsubB);
        // annoProp is in ont1 and in the import closure of ont2
        assertTrue(containsConsiderEx(ont1, axannoPropdecl));
        assertFalse(containsConsiderEx(ont2, axannoPropdecl));
View Full Code Here

        assert ont2iri != null;
        OWLImportsDeclaration ont2import = ImportsDeclaration(ont1iri);
        ont2.getOWLOntologyManager().applyChange(
                new AddImport(ont2, ont2import));
        OWLAnnotationProperty annoProp = AnnotationProperty(iri("annoProp"));
        OWLAxiom axAnnoPropDecl = Declaration(annoProp);
        ont1.getOWLOntologyManager().addAxiom(ont1, axAnnoPropDecl);
        OWLAnnotation inOnt1Anno = Annotation(annoProp, ont1iri);
        OWLAnnotation inOnt2Anno = Annotation(annoProp, ont2iri);
        OWLClass a = Class(iri("A"));
        OWLAxiom axADecl = Declaration(a, singleton(inOnt1Anno));
        ont1.getOWLOntologyManager().addAxiom(ont1, axADecl);
        OWLClass b = Class(iri("B"));
        OWLAxiom axBDecl = Declaration(b, singleton(inOnt2Anno));
        ont2.getOWLOntologyManager().addAxiom(ont2, axBDecl);
        OWLAxiom axAsubB = SubClassOf(Class(iri("A")), Class(iri("B")),
                singleton(inOnt2Anno));
        ont2.getOWLOntologyManager().addAxiom(ont2, axAsubB);
        // annoProp is in ont1 and in the import closure of ont2
        assertTrue(containsConsiderEx(ont1, axAnnoPropDecl));
        assertFalse(containsConsiderEx(ont2, axAnnoPropDecl));
View Full Code Here

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        OWLAnnotationProperty subProp = AnnotationProperty(IRI("http://ont.com#myLabel"));
        OWLAnnotationProperty superProp = RDFSLabel();
        OWLAxiom ax = df.getOWLSubAnnotationPropertyOfAxiom(subProp, superProp);
        return singleton(ax);
    }
View Full Code Here

public class OntologyMutationTestCase extends TestBase {

    @Test
    public void testAddAxiom() {
        OWLOntology ont = getOWLOntology("OntA");
        OWLAxiom ax = SubClassOf(Class(iri("A")), OWLThing());
        final List<OWLOntologyChange> chgs = new ArrayList<>();
        ont.getOWLOntologyManager().addOntologyChangeListener(
                new OWLOntologyChangeListener() {

                    @Override
View Full Code Here

    }

    @Test
    public void testAddAxioms() {
        OWLOntology ont = getOWLOntology("OntB");
        OWLAxiom ax = SubClassOf(Class(iri("A")), OWLThing());
        final List<OWLOntologyChange> chgs = new ArrayList<>();
        ont.getOWLOntologyManager().addOntologyChangeListener(
                new OWLOntologyChangeListener() {

                    @Override
View Full Code Here

    }

    @Test
    public void testApplyChange() {
        OWLOntology ont = getOWLOntology("OntC");
        OWLAxiom ax = SubClassOf(Class(iri("A")), OWLThing());
        final List<OWLOntologyChange> chgs = new ArrayList<>();
        ont.getOWLOntologyManager().addOntologyChangeListener(
                new OWLOntologyChangeListener() {

                    @Override
View Full Code Here

    }

    @Test
    public void testApplyChanges() {
        OWLOntology ont = getOWLOntology("OntD");
        OWLAxiom ax = SubClassOf(Class(iri("A")), OWLThing());
        final List<OWLOntologyChange> chgs = new ArrayList<>();
        ont.getOWLOntologyManager().addOntologyChangeListener(
                new OWLOntologyChangeListener() {

                    @Override
View Full Code Here

        OWLOntology ontology = m.createOntology(IRI(ns));
        OWLClass a = Class(IRI(ns + "#A"));
        m.addAxiom(ontology, df.getOWLDeclarationAxiom(a));
        OWLAnnotation ann = df.getOWLAnnotation(df.getRDFSLabel(),
                df.getOWLLiteral("Chinese=處方"));
        OWLAxiom axiom = df.getOWLAnnotationAssertionAxiom(a.getIRI(), ann);
        m.addAxiom(ontology, axiom);
        ontology = roundTrip(ontology, new FunctionalSyntaxDocumentFormat());
    }
View Full Code Here

TOP

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

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.