Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLAnnotation


        SWRLVariable x = df.getSWRLVariable(IRI(NS + "#x"));
        SWRLAtom atom1 = df.getSWRLClassAtom(a, x);
        SWRLAtom atom2 = df.getSWRLClassAtom(b, x);
        Set<SWRLAtom> consequent = new TreeSet<>();
        consequent.add(atom1);
        OWLAnnotation annotation = df.getOWLAnnotation(RDFSComment(),
                Literal("Not a great rule"));
        Set<OWLAnnotation> annotations = new TreeSet<>();
        annotations.add(annotation);
        Set<SWRLAtom> body = new TreeSet<>();
        body.add(atom2);
View Full Code Here


    public void testPositiveUTF8roundTrip() throws Exception {
        String ns = "http://protege.org/UTF8.owl";
        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

        OWLAnonymousIndividual h = AnonymousIndividual();
        OWLAnonymousIndividual i = AnonymousIndividual();
        OWLAnnotationProperty p = AnnotationProperty(IRI(ns + "#p"));
        OWLObjectProperty q = ObjectProperty(IRI(ns + "#q"));
        OWLOntology ontology = m.createOntology(IRI(ns));
        OWLAnnotation annotation1 = df.getOWLAnnotation(p, h);
        m.addAxiom(ontology,
                df.getOWLAnnotationAssertionAxiom(a.getIRI(), annotation1));
        m.addAxiom(ontology, ClassAssertion(a, h));
        m.addAxiom(ontology, ObjectPropertyAssertion(q, h, i));
        OWLAnnotation annotation2 = df.getOWLAnnotation(df.getRDFSLabel(),
                Literal("Second", "en"));
        m.addAxiom(ontology, df.getOWLAnnotationAssertionAxiom(h, annotation2));
        roundTrip(ontology, new ManchesterSyntaxDocumentFormat());
    }
View Full Code Here

    protected OWLOntology createOntology() {
        try {
            OWLOntology ont = m.createOntology();
            OWLAnnotationProperty prop = AnnotationProperty(IRI("http://www.semanticweb.org/ontologies/test/annotationont#prop"));
            OWLLiteral value = Literal(33);
            OWLAnnotation annotation = df.getOWLAnnotation(prop, value);
            ont.getOWLOntologyManager().applyChange(
                    new AddOntologyAnnotation(ont, annotation));
            ont.getOWLOntologyManager().addAxiom(ont, Declaration(prop));
            return ont;
        } catch (OWLOntologyCreationException e) {
View Full Code Here

                .getIRI());
        Set<OWLAnnotation> toReturn = new HashSet<>();
        for (OWLAnnotation a : anns) {
            Optional<OWLLiteral> asLiteral = a.getValue().asLiteral();
            if (asLiteral.isPresent() && asLiteral.get().isRDFPlainLiteral()) {
                OWLAnnotation replacement = df.getOWLAnnotation(
                        a.getProperty(), df.getOWLLiteral(asLiteral.get()
                                .getLiteral(), stringType));
                toReturn.add(replacement);
            } else {
                toReturn.add(a);
View Full Code Here

    @Test
    public void testGetAxiomsIgnoringAnnoations() {
        OWLLiteral annoLiteral = Literal("value");
        OWLAnnotationProperty annoProp = AnnotationProperty(iri("annoProp"));
        OWLAnnotation anno = df.getOWLAnnotation(annoProp, annoLiteral);
        OWLAxiom axiom = df.getOWLSubClassOfAxiom(Class(iri("A")),
                Class(iri("B")), singleton(anno));
        OWLOntology ont = getOWLOntology("testont");
        ont.getOWLOntologyManager().addAxiom(ont, axiom);
        assertTrue(ont.getAxiomsIgnoreAnnotations(axiom, EXCLUDED).contains(
View Full Code Here

    @Test
    public void testContainsReferenceForAxiomAnnotation() {
        OWLAnnotationProperty ap = AnnotationProperty(iri("prop"));
        OWLLiteral val = Literal("Test", "");
        OWLAnnotation anno = df.getOWLAnnotation(ap, val);
        OWLSubClassOfAxiom ax = df.getOWLSubClassOfAxiom(Class(iri("A")),
                Class(iri("B")), singleton(anno));
        OWLOntology ont = getOWLOntology("Ont");
        ont.getOWLOntologyManager().addAxiom(ont, ax);
        assertTrue(ont.containsAnnotationPropertyInSignature(anno.getProperty()
                .getIRI(), EXCLUDED));
        assertTrue(ont.getAnnotationPropertiesInSignature(EXCLUDED).contains(
                anno.getProperty()));
    }
View Full Code Here

    @Test
    public void testContainsReferenceForOntologyAnnotation() {
        OWLAnnotationProperty ap = AnnotationProperty(iri("prop"));
        OWLLiteral val = Literal("Test");
        OWLAnnotation anno = df.getOWLAnnotation(ap, val);
        OWLOntology ont = getOWLOntology("Ont");
        ont.getOWLOntologyManager().applyChange(
                new AddOntologyAnnotation(ont, anno));
        assertTrue(ont.containsAnnotationPropertyInSignature(anno.getProperty()
                .getIRI(), EXCLUDED));
        assertTrue(ont.getAnnotationPropertiesInSignature(EXCLUDED).contains(
                anno.getProperty()));
    }
View Full Code Here

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        OWLAnnotationProperty ap = AnnotationProperty(IRI("http://annotation.com/annos#prop"));
        OWLLiteral val = Literal("Test", "");
        OWLAnnotation anno = Annotation(ap, val);
        Set<OWLAnnotation> annos = new HashSet<>();
        annos.add(anno);
        OWLClassExpression ce = Class(iri("A"));
        OWLObjectProperty p1 = ObjectProperty(iri("p1"));
        OWLObjectProperty p2 = ObjectProperty(iri("p2"));
View Full Code Here

            String comment) {
        // Just register the namespace with the consumer and add it as an
        // annotation to the ontology
        getConsumer().setDefaultNamespaceTagValue(value);
        // Add an annotation to the ontology
        OWLAnnotation annotation = getAnnotationForTagValuePair(
                OBOVocabulary.DEFAULT_NAMESPACE.getName(), value);
        applyChange(new AddOntologyAnnotation(getOntology(), annotation));
    }
View Full Code Here

TOP

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

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.