Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLAnnotationProperty


    protected IRI getIriByLabel(@Nonnull OWLOntology ontology,
            @Nonnull String label) {
        for (OWLAnnotationAssertionAxiom aa : ontology
                .getAxioms(AxiomType.ANNOTATION_ASSERTION)) {
            OWLAnnotationValue v = aa.getValue();
            OWLAnnotationProperty property = aa.getProperty();
            if (property.isLabel() && v instanceof OWLLiteral) {
                if (label.equals(((OWLLiteral) v).getLiteral())) {
                    OWLAnnotationSubject subject = aa.getSubject();
                    if (subject instanceof IRI) {
                        return (IRI) subject;
                    }
View Full Code Here


                            .applyChange(new AddImport(ontology, decl));
                } else {
                    // Ontology annotations
                    OWLLiteral con = getDataFactory().getOWLLiteral(
                            unescapeTagValue(value));
                    OWLAnnotationProperty property = getDataFactory()
                            .getOWLAnnotationProperty(getIRIFromTagName(tag));
                    OWLAnnotation anno = getDataFactory().getOWLAnnotation(
                            property, con);
                    owlOntologyManager.applyChange(new AddOntologyAnnotation(
                            ontology, anno));
                }
            } else if (currentId != null) {
                // Add as annotation
                if (configuration.isLoadAnnotationAxioms()) {
                    IRI subject = getIRI(currentId);
                    OWLLiteral con = getDataFactory().getOWLLiteral(
                            unescapeTagValue(value));
                    IRI annotationPropertyIRI = getIRIFromTagName(tag);
                    OWLAnnotationProperty property = getDataFactory()
                            .getOWLAnnotationProperty(annotationPropertyIRI);
                    OWLAnnotation anno = getDataFactory().getOWLAnnotation(
                            property, con);
                    OWLAnnotationAssertionAxiom ax = getDataFactory()
                            .getOWLAnnotationAssertionAxiom(subject, anno);
View Full Code Here

            if (idType != null) {
                annotationValue = getIRIFromOBOId(xrefId);
            } else {
                annotationValue = getDataFactory().getOWLLiteral(xrefId);
            }
            OWLAnnotationProperty xrefProperty = df
                    .getOWLAnnotationProperty(OBOVocabulary.XREF.getIRI());
            return df.getOWLAnnotation(xrefProperty, annotationValue,
                    xrefDescriptions);
        } else {
            OWLDataFactory df = getDataFactory();
            OWLAnnotationProperty xrefProperty = df
                    .getOWLAnnotationProperty(OBOVocabulary.XREF.getIRI());
            return df.getOWLAnnotation(xrefProperty, df.getOWLLiteral(xref));
        }
    }
View Full Code Here

        OWLOntologyManager m = create();
        OWLOntology o = loadPizzaOntology(m);
        // We want to add a comment to the pizza class.
        OWLLiteral lit = df.getOWLLiteral("Added a comment to the pizza class");
        // create an annotation to pair a URI with the constant
        OWLAnnotationProperty owlAnnotationProperty = df
                .getOWLAnnotationProperty(OWLRDFVocabulary.OWL_VERSION_INFO
                        .getIRI());
        OWLAnnotation anno = df.getOWLAnnotation(owlAnnotationProperty, lit);
        // Now we can add this as an ontology annotation
        // Apply the change in the usual way
View Full Code Here

        // language tags. For each class in the ontology, we retrieve its
        // annotations and sift through them. If the annotation annotates the
        // class with a constant which is untyped then we check the language tag
        // to see if it is Portugeuse. Firstly, get the annotation property for
        // rdfs:label
        OWLAnnotationProperty label = df
                .getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI());
        for (OWLClass cls : ont.getClassesInSignature()) {
            // Get the annotations on the class that use the label property
            for (OWLAnnotation annotation : annotations(ont.filterAxioms(
                    Filters.annotations, cls.getIRI(), INCLUDED), label)) {
View Full Code Here

        AbstractAxiomsRoundTrippingTestCase {

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        OWLAnnotationProperty prop = AnnotationProperty(iri("prop"));
        OWLLiteral lit = Literal("Test", "");
        OWLAnnotation anno1 = df.getOWLAnnotation(prop, lit);
        OWLAnnotationProperty prop2 = AnnotationProperty(iri("prop2"));
        OWLAnnotation anno2 = df.getOWLAnnotation(prop2, lit);
        Set<OWLAnnotation> annos = new HashSet<>();
        // Add two annotations per axiom
        annos.add(anno1);
        annos.add(anno2);
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);
View Full Code Here

        @Nonnull
        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"));
View Full Code Here

        assert ont1iri != null;
        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"));
View Full Code Here

public class AnnotationPropertyConvenienceMethodTestCase extends TestBase {

    @Test
    public void testGetSuperProperties() {
        OWLOntology ont = getOWLOntology("OntA");
        OWLAnnotationProperty propP = AnnotationProperty(iri("propP"));
        OWLAnnotationProperty propQ = AnnotationProperty(iri("propQ"));
        OWLAnnotationProperty propR = AnnotationProperty(iri("propR"));
        ont.getOWLOntologyManager().addAxiom(ont,
                df.getOWLSubAnnotationPropertyOfAxiom(propP, propQ));
        ont.getOWLOntologyManager().addAxiom(ont,
                df.getOWLSubAnnotationPropertyOfAxiom(propP, propR));
        Collection<OWLAxiom> axioms = ont.filterAxioms(
View Full Code Here

TOP

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

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.