Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLAnnotation


    private final Set<SWRLAtom> head = new HashSet<>(Arrays.asList(v2));

    @Test
    public void shouldBuildAnnotation() {
        // given
        OWLAnnotation expected = df.getOWLAnnotation(ap, lit);
        BuilderAnnotation builder = new BuilderAnnotation(expected, df);
        // when
        OWLObject built = builder.buildObject();
        // then
        assertEquals(expected, built);
View Full Code Here


                + ":FMDomain rdf:type owl:NamedIndividual , prov:Activity ; prov:ass :DM .";
        OWLOntology ontology = loadOntologyFromString(input);
        OWLOntology o = roundTrip(ontology, new TurtleDocumentFormat());
        Set<OWLSubClassOfAxiom> axioms = o.getAxioms(AxiomType.SUBCLASS_OF);
        assertEquals(1, axioms.size());
        OWLAnnotation next = axioms.iterator().next().getAnnotations()
                .iterator().next();
        assertTrue(next.getValue() instanceof OWLAnonymousIndividual);
        OWLAnonymousIndividual ind = (OWLAnonymousIndividual) next.getValue();
        Set<OWLAxiom> anns = new HashSet<>();
        for (OWLAxiom ax : o.getAxioms()) {
            if (ax.getAnonymousIndividuals().contains(ind)) {
                anns.add(ax);
            }
View Full Code Here

    @Test
    public void testPlainLiteralSerializationComments2() throws Exception {
        OWLOntology o = m.createOntology();
        OWLLiteral l = m.getOWLDataFactory().getOWLLiteral("test",
                OWL2Datatype.RDF_PLAIN_LITERAL);
        OWLAnnotation a = m.getOWLDataFactory().getOWLAnnotation(
                m.getOWLDataFactory().getRDFSComment(), l);
        m.applyChange(new AddOntologyAnnotation(o, a));
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        m.saveOntology(o, out);
        String expected = "<rdfs:comment>test</rdfs:comment>";
View Full Code Here

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLAnnotation annoOuterOuter1 = df.getOWLAnnotation(
                AnnotationProperty(iri("myOuterOuterLabel1")),
                Literal("Outer Outer label 1"));
        OWLAnnotation annoOuterOuter2 = df.getOWLAnnotation(
                AnnotationProperty(iri("myOuterOuterLabel2")),
                Literal("Outer Outer label 2"));
        Set<OWLAnnotation> outerOuterAnnos = new HashSet<>();
        outerOuterAnnos.add(annoOuterOuter1);
        outerOuterAnnos.add(annoOuterOuter2);
        OWLAnnotation annoOuter = df.getOWLAnnotation(
                AnnotationProperty(iri("myOuterLabel")),
                Literal("Outer label"), outerOuterAnnos);
        OWLAnnotation annoInner = df.getOWLAnnotation(
                AnnotationProperty(iri("myLabel")), Literal("Label"),
                singleton(annoOuter));
        OWLAxiom ax = df.getOWLSubClassOfAxiom(Class(iri("A")),
                Class(iri("B")), singleton(annoInner));
        axioms.add(ax);
View Full Code Here

        body.add(df.getSWRLDataPropertyAtom(p, x, y));
        body.add(df.getSWRLDataRangeAtom(
                df.getOWLDatatype(XSDVocabulary.STRING.getIRI()), y));
        Set<SWRLAtom> head = new TreeSet<>();
        head.add(df.getSWRLClassAtom(a, x));
        OWLAnnotation ann = df.getOWLAnnotation(df.getRDFSLabel(),
                df.getOWLLiteral("test", ""));
        SWRLRule rule = df.getSWRLRule(body, head, singleton(ann));
        ontology.getOWLOntologyManager().addAxiom(ontology, rule);
        OWLDatatypeDefinitionAxiom def = df.getOWLDatatypeDefinitionAxiom(
                df.getOWLDatatype(IRI.create("urn:mydatatype")),
View Full Code Here

    @Override
    protected OWLOntology createOntology() {
        OWLOntology ont = getOWLOntology("AnnotationOntology");
        OWLAnnotationProperty prop = AnnotationProperty(IRI("http://www.semanticweb.org/ontologies/test/annotationont#prop"));
        OWLLiteral value = Literal(33);
        OWLAnnotation annotation = Annotation(prop, value);
        ont.getOWLOntologyManager().applyChange(
                new AddOntologyAnnotation(ont, annotation));
        ont.getOWLOntologyManager().addAxiom(ont, Declaration(prop));
        return ont;
    }
View Full Code Here

                value = df.getOWLAnonymousIndividual(object.toString());
            } else {
                value = object;
            }
            OWLAnnotationProperty prop = df.getOWLAnnotationProperty(predicate);
            OWLAnnotation anno = df.getOWLAnnotation(prop, value);
            OWLAnnotationSubject annoSubject;
            if (isAnonymous(subject)) {
                annoSubject = df.getOWLAnonymousIndividual(subject.toString());
            } else {
                annoSubject = subject;
View Full Code Here

        }
    }

    private Set<OWLAnnotation> getSynonymTypeAnnotations(Matcher matcher) {
        if (matcher.group(SYNONYM_TYPE_GROUP) != null) {
            OWLAnnotation typeAnnotation = getSynonymTypeAnnotation(matcher);
            return Collections.singleton(typeAnnotation);
        } else {
            return Collections.emptySet();
        }
    }
View Full Code Here

        if (xrefs != null) {
            StringTokenizer tokenizer = new StringTokenizer(xrefs, ",");
            while (tokenizer.hasMoreTokens()) {
                String xref = tokenizer.nextToken();
                assert xref != null;
                OWLAnnotation xrefAnnotation = getConsumer().parseXRef(xref);
                annotations.add(xrefAnnotation);
            }
        }
        return annotations;
    }
View Full Code Here

            OWLLiteral nameLiteral = df.getOWLLiteral(name);
            applyChange(new AddAxiom(getOntology(),
                    df.getOWLAnnotationAssertionAxiom(df.getRDFSLabel(),
                            annotationPropertyIRI, nameLiteral)));
        } else {
            OWLAnnotation annotation = getAnnotationForTagValuePair(
                    OBOVocabulary.SYNONYM_TYPE_DEF.getName(), value);
            applyChange(new AddOntologyAnnotation(getOntology(), annotation));
        }
        // ID QuotedString [Scope]
        // 18th April 2012
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.