Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLOntology


    @Test
    public void shouldParseScientificNotationWithMinus()
            throws OWLOntologyCreationException {
        String input = "<http://dbpedia.org/resource/South_Africa> <http://dbpedia.org/ontology/areaTotal> 1e-07 .";
        OWLOntology ontology = loadOntologyFromString(input);
        OWLAnnotationProperty p = AnnotationProperty(IRI("http://dbpedia.org/ontology/areaTotal"));
        assertTrue(ontology.getAnnotationPropertiesInSignature(EXCLUDED)
                .contains(p));
        IRI i = IRI("http://dbpedia.org/resource/South_Africa");
        assertTrue(ontology.containsAxiom(AnnotationAssertion(p, i,
                Literal("1.0E-7", OWL2Datatype.XSD_DOUBLE))));
    }
View Full Code Here


    }

    @Test
    public void shouldParseTwo() throws OWLOntologyCreationException {
        String input = "<http://dbpedia.org/resource/South_Africa> <http://dbpedia.org/ontology/areaTotal> 1 .";
        OWLOntology ontology = loadOntologyFromString(input);
        OWLAnnotationProperty p = AnnotationProperty(IRI("http://dbpedia.org/ontology/areaTotal"));
        assertTrue(ontology.getAnnotationPropertiesInSignature(EXCLUDED)
                .contains(p));
        IRI i = IRI("http://dbpedia.org/resource/South_Africa");
        assertTrue(ontology
                .containsAxiom(AnnotationAssertion(p, i, Literal(1))));
    }
View Full Code Here

    }

    @Test
    public void shouldParseOne() throws OWLOntologyCreationException {
        String input = "<http://dbpedia.org/resource/South_Africa> <http://dbpedia.org/ontology/areaTotal> 1.0.";
        OWLOntology ontology = loadOntologyFromString(input);
        OWLAnnotationProperty p = AnnotationProperty(IRI("http://dbpedia.org/ontology/areaTotal"));
        assertTrue(ontology.getAnnotationPropertiesInSignature(EXCLUDED)
                .contains(p));
        IRI i = IRI("http://dbpedia.org/resource/South_Africa");
        assertTrue(ontology.containsAxiom(AnnotationAssertion(p, i,
                Literal("1.0", OWL2Datatype.XSD_DECIMAL))));
    }
View Full Code Here

    @Nonnull
    private static final String NS = "http://ns.owl";

    @Test
    public void shouldParse() throws OWLOntologyCreationException {
        OWLOntology ontology = buildOntology();
        String input = "Prefix: owl: <http://www.w3.org/2002/07/owl#>\n Prefix: piz: <http://ns.owl#>\n Prefix: rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n Prefix: xml: <http://www.w3.org/XML/1998/namespace>\n Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>\n Prefix: rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n\n Ontology: <http://ns.owl>\n"
                + " Class: piz:F\n Class: piz:E\n Class: piz:D\n Class: piz:C\n DisjointClasses: \n ( piz:D or piz:C),\n (piz:E or piz:C),\n (piz:F or piz:C)";
        OWLOntology roundtripped = loadOntologyFromString(input);
        assertEquals(input, ontology.getLogicalAxioms(),
                roundtripped.getLogicalAxioms());
    }
View Full Code Here

    public void shouldParseEmptySpaceInBnode()
            throws OWLOntologyCreationException {
        String input = "<http://taxonomy.wolterskluwer.de/practicearea/10112>\n a <http://schema.wolterskluwer.de/TaxonomyTerm> , <http://www.w3.org/2004/02/skos/core#Concept> ;\n"
                + "      <http://www.w3.org/2004/02/skos/core#broader>\n [] ;\n"
                + "      <http://www.w3.org/2004/02/skos/core#broader>\n [] .";
        OWLOntology ontology = loadOntologyFromString(input);
        OWLIndividual i = NamedIndividual(IRI("http://taxonomy.wolterskluwer.de/practicearea/10112"));
        OWLAnnotationProperty ap = AnnotationProperty(IRI("http://www.w3.org/2004/02/skos/core#broader"));
        OWLClass c = Class(IRI("http://www.w3.org/2004/02/skos/core#Concept"));
        OWLClass term = Class(IRI("http://schema.wolterskluwer.de/TaxonomyTerm"));
        assertTrue(ontology.containsAxiom(ClassAssertion(c, i)));
        assertTrue(ontology.containsAxiom(ClassAssertion(term, i)));
        assertTrue(ontology.containsEntityInSignature(ap));
    }
View Full Code Here

                roundtripped.getLogicalAxioms());
    }

    @Test
    public void shouldRoundTrip() throws Exception {
        OWLOntology ontology = buildOntology();
        PrefixDocumentFormat format = new ManchesterSyntaxDocumentFormat();
        format.setPrefix("piz", NS + '#');
        OWLOntology roundtripped = roundTrip(ontology, format);
        assertEquals(ontology.getLogicalAxioms(),
                roundtripped.getLogicalAxioms());
    }
View Full Code Here

    private OWLOntology buildOntology() throws OWLOntologyCreationException {
        OWLClass c = Class(IRI(NS + "#C"));
        OWLClass d = Class(IRI(NS + "#D"));
        OWLClass e = Class(IRI(NS + "#E"));
        OWLClass f = Class(IRI(NS + "#F"));
        OWLOntology ontology = m.createOntology(IRI(NS));
        OWLDisjointClassesAxiom disjointClasses = DisjointClasses(
                ObjectUnionOf(c, d), ObjectUnionOf(c, e), ObjectUnionOf(c, f));
        m.addAxiom(ontology, disjointClasses);
        return ontology;
    }
View Full Code Here

                + "  owl:annotatedProperty rdfs:subClassOf ;\n"
                + "  :prov [\n prov:gen :FMDomain ;\n prov:att :DM .\n ]\n ] .\n"
                + ":ManagementType rdf:type owl:Class .\n"
                + ":DM rdf:type owl:NamedIndividual , prov:Person .\n"
                + ":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);
            }
        }
        assertEquals(3, anns.size());
View Full Code Here

                + "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n"
                + "@base <urn:test#test.owl/> .\n"
                + "<urn:test#test.owl/> rdf:type owl:Ontology .\n"
                + ":q rdf:type owl:Class .\n"
                + ":t rdf:type owl:Class ; rdfs:subClassOf :q .";
        OWLOntology in = loadOntologyFromString(input);
        String string = "urn:test#test.owl/";
        OWLOntology ontology = m.createOntology(IRI.create(string));
        m.addAxiom(
                ontology,
                df.getOWLSubClassOfAxiom(
                        df.getOWLClass(IRI.create(string + 't')),
                        df.getOWLClass(IRI.create(string + 'q'))));
        OWLOntology o = roundTrip(ontology, new TurtleDocumentFormat());
        equal(o, in);
    }
View Full Code Here

    @Test
    public void presentDeclaration() throws OWLOntologyCreationException {
        // given
        String input = "<urn:test#Settlement> rdf:type owl:Class.\n <urn:test#fm2.owl> rdf:type owl:Ontology.\n <urn:test#numberOfPads> rdf:type owl:ObjectProperty ;\n rdfs:domain <urn:test#Settlement> .";
        // when
        OWLOntology o = loadOntologyFromString(input);
        // then
        for (OWLLogicalAxiom ax : o.getLogicalAxioms()) {
            assertTrue(ax instanceof OWLObjectPropertyDomainAxiom);
        }
    }
View Full Code Here

TOP

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

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.