Package org.semanticweb.owlapi.profiles

Examples of org.semanticweb.owlapi.profiles.OWLProfileReport


        // create and apply the new change
        AddAxiom change = new AddAxiom(o, (OWLAxiom) object);
        o.getOWLOntologyManager().applyChange(change);
        List<OWLOntologyChange> changes = new ArrayList<>();
        // check conformity to the profile
        OWLProfileReport report = profile.checkOntology(o);
        for (OWLProfileViolation v : report.getViolations()) {
            // collect all changes to fix the ontology
            changes.addAll(v.repair());
        }
        // fix the ontology
        o.getOWLOntologyManager().applyChanges(changes);
View Full Code Here


    public void testCheckProfile() throws OWLException {
        OWLOntologyManager m = create();
        OWLOntology o = m.createOntology(KOALA_IRI);
        // Available profiles: DL, EL, QL, RL, OWL2 (Full)
        OWL2DLProfile profile = new OWL2DLProfile();
        OWLProfileReport report = profile.checkOntology(o);
        for (OWLProfileViolation v : report.getViolations()) {
            // deal with violations
            System.out.println(v);
        }
    }
View Full Code Here

        }
    }

    private static void checkProfile(OWLOntology ontology,
            @Nonnull OWLProfile profile, boolean shouldBeInProfile) {
        OWLProfileReport report = profile.checkOntology(ontology);
        assertEquals(shouldBeInProfile, report.isInProfile());
    }
View Full Code Here

    protected void test(@Nonnull String in, boolean el, boolean ql, boolean rl,
            boolean dl) {
        OWLOntology o = o(in);
        assertTrue("empty ontology", !o.getAxioms().isEmpty());
        OWLProfileReport elReport = el(o);
        assertEquals(elReport.toString(), el, elReport.isInProfile());
        OWLProfileReport qlReport = ql(o);
        assertEquals(qlReport.toString(), ql, qlReport.isInProfile());
        OWLProfileReport rlReport = rl(o);
        assertEquals(rlReport.toString(), rl, rlReport.isInProfile());
        OWLProfileReport dlReport = dl(o);
        assertEquals(dlReport.toString(), dl, dlReport.isInProfile());
    }
View Full Code Here

    @Test
    public void shouldFindViolation() throws Exception {
        String input = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" ><owl:Ontology rdf:about=\"\"/>\n<owl:Class rdf:about=\"http://phenomebrowser.net/cellphenotype.owl#C3PO:000000015\"><rdf:Description rdf:datatype=\"http://www.w3.org/2001/XMLSchema#string\">Any.</rdf:Description></owl:Class></rdf:RDF>";
        OWLOntology o = loadOntologyFromString(input);
        OWL2DLProfile p = new OWL2DLProfile();
        OWLProfileReport checkOntology = p.checkOntology(o);
        assertEquals(2, checkOntology.getViolations().size());
        OWLProfileViolation v = checkOntology.getViolations().get(0);
        assertTrue(v instanceof UseOfUndeclaredAnnotationProperty
                || v instanceof UseOfReservedVocabularyForAnnotationPropertyIRI);
        v = checkOntology.getViolations().get(1);
        assertTrue(v instanceof UseOfUndeclaredAnnotationProperty
                || v instanceof UseOfReservedVocabularyForAnnotationPropertyIRI);
    }
View Full Code Here

                + "<owl:onProperty rdf:resource=\"http://www.co-ode.org/ontologies/galen#hasQuantity\"/>\n"
                + "<owl:someValuesFrom><owl:Class rdf:about=\"http://www.co-ode.org/ontologies/galen#anotherTest\"/></owl:someValuesFrom>\n"
                + "</owl:Restriction></rdfs:subClassOf></owl:Class></rdf:RDF>";
        OWLOntology o = loadOntologyFromString(test);
        OWL2DLProfile profile = new OWL2DLProfile();
        OWLProfileReport report = profile.checkOntology(o);
        assertTrue(report.isInProfile());
    }
View Full Code Here

                + "<rdf:type rdf:resource=\"http://www.w3.org/2002/07/owl#DatatypeProperty\"/>\n"
                + "<rdfs:subPropertyOf rdf:resource=\"http://ex.com#p1\"/>\n"
                + "</rdf:Property>\n" + "</rdf:RDF>";
        OWLOntology o = loadOntologyFromString(onto);
        OWL2RLProfile p = new OWL2RLProfile();
        OWLProfileReport report = p.checkOntology(o);
        assertTrue(report.getViolations().isEmpty());
    }
View Full Code Here

        this.profile = profile;
    }

    @Override
    public ProfileMetricValue computeValue() {
        OWLProfileReport report = profile.checkOntology(getRootOntology());
        return new ProfileMetricValue(profile.getName(), report.isInProfile());
    }
View Full Code Here

    }
  }
 
  private String getOWL2DLProfileViolations( OWLOntology ontology ) {
    OWL2DLProfile owl2Profile = new OWL2DLProfile();
    OWLProfileReport profileReport = owl2Profile.checkOntology( ontology );
   
    if( profileReport.isInProfile() ) {
      return "No OWL 2 DL violations found for ontology " + ontology.getOntologyID().toString();
    }
   
    StringBuffer result = new StringBuffer();
    result.append( "\n=========================================================\n" );
    result.append("OWL 2 DL violations found for ontology ").append(ontology.getOntologyID().toString()).append(":\n");
   
    for ( OWLProfileViolation violation : profileReport.getViolations() ) {
      result.append( violation.toString() );
      result.append( "\n" );
    }
   
    return result.toString();
View Full Code Here

    }
  }
 
  private String getOWL2DLProfileViolations( OWLOntology ontology ) {
    OWL2DLProfile owl2Profile = new OWL2DLProfile();
    OWLProfileReport profileReport = owl2Profile.checkOntology( ontology );
   
    if( profileReport.isInProfile() ) {
      return "No OWL 2 DL violations found for ontology " + ontology.getOntologyID().toString();
    }
   
    StringBuffer result = new StringBuffer();
    result.append( "\n=========================================================\n" );
    result.append("OWL 2 DL violations found for ontology ").append(ontology.getOntologyID().toString()).append(":\n");
   
    for ( OWLProfileViolation violation : profileReport.getViolations() ) {
      result.append( violation.toString() );
      result.append( "\n" );
    }
   
    return result.toString();
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.profiles.OWLProfileReport

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.