0

I've created a model with the Jena Lib and I want to validate it against a specific schema.rdf. However when I start the validation, it says everything okay, but I have a significant schema-violation in my Model as you can see below. In my example, the problem is now that I have a Topic with the property "has-component" but "has-component" as a property is in the schema just allowed for "#Component"-class.
My Question is now: Which reasoner can I use to get an error message after validation?

PS: I tried nearly all different reasoners from jena with all different parameters, but it still doesn't work.

My code is:

Model schema = RDFDataMgr.loadModel("schema.rdf");
Model data = RDFDataMgr.loadModel("data.rdf");
Resource config = ModelFactory.createDefaultModel()
          .createResource()
          .addProperty(ReasonerVocabulary.PROPsetRDFSLevel, "full");        
Reasoner reasoner = RDFSRuleReasonerFactory.theInstance().create(config);
InfModel infmodel = ModelFactory.createInfModel(reasoner,schema,metadata);

ValidityReport validityReport = infmodel.validate();
if (validityReport.isValid()) {
    System.out.println("OK");
} else {
    System.out.println("Conflicts");
    for (Iterator i = validityReport.getReports(); i.hasNext();) {
        System.out.println(" - " + i.next());
    }
}

Example from data.rdf:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:ixsr="http://ixsr.abokom.de/ixsr#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> 
[....]
  <ixsr:Topic rdf:about="http://ixsr.lebfy.de/topics/05d2c8268b68ff6444a49358ca7fe925/1/de-de">
    <ixsr:has-component rdf:resource="http://ixsr.lebfy.de/metadata/85e7506eb2e33f90c0a802687f559f0c"/>
    <ixsr:title xml:lang="de-de">Kontaktdaten</ixsr:title>
    <ixsr:relates-to-component rdf:resource="http://ixsr.lebfy.de/metadata/85e7506eb2e33f90c0a802687f559f0c"/>
    <ixsr:relates-to-product-feature rdf:resource="http://ixsr.lebfy.de/metadata/dbbb7334b2e2a9e5c0a8026860d20c17"/>
    <ixsr:relates-to-product-feature rdf:resource="http://ixsr.lebfy.de/metadata/10b4c299b2ddae19c0a8026824aa7410"/>
    <ixsr:relates-to-product-feature rdf:resource="http://ixsr.lebfy.de/metadata/b63e4b15b2dc2d83c0a8026877f6aa88"/>
    <ixsr:dateOfCreation xml:lang="de-de">2020-08-06T12:24:07.285+02:00</ixsr:dateOfCreation>
  </ixsr:Topic>
[....]

Example from schema.rdf:

<rdf:RDF xmlns:ixsr="http://ixsr.abokom.de/ixsr#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:schema="http://schema.org/" xml:base="http://ixsr.abokom.de/ixsr#" xml:lang="en">
[....]
<rdf:Property rdf:about="http://ixsr.abokom.de/ixsr#has-component">
<rdfs:label xml:lang="de">hat Komponente</rdfs:label>
<rdfs:label xml:lang="en">has component</rdfs:label>
<rdfs:subPropertyOf rdf:resource="http://ixsr.abokom.de/ixsr#ixsrRelationConcept"/>
<rdfs:domain rdf:resource="http://ixsr.abokom.de/ixsr#Component"/>
<rdfs:range rdf:resource="http://ixsr.abokom.de/ixsr#Component"/>
<ixsr:description xml:lang="en"/>
<rdfs:comment xml:lang="en">Relates to a component that is part of another component.</rdfs:comment>
<rdfs:comment xml:lang="de">Verweist auf eine Kompoente, die Teil einer anderen Komponente ist.</rdfs:comment>
<schema:domainIncludes rdf:resource="http://ixsr.abokom.de/ixsr#Component"/>
<schema:rangeIncludes rdf:resource="http://ixsr.abokom.de/ixsr#Component"/>
<ixsr:description xml:lang="en">Cardinality: http://ixsr.abokom.de/ixsr#Component [0..*]</ixsr:description>
</rdf:Property>
[....]
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
fandrale
  • 21
  • 2
  • validating in RDF and OWL via a reasoner doesn't do what you think. It's all about reasoning, i.e. inferring implicit facts. All that `validate` would do is checking for an inconsistent model w.r.t. semantics. Anyhting beyond can't be done via standard reasoning because of Open World assumption. What you need is some kind of constraint validation, so you should use SHACL via Jena https://jena.apache.org/documentation/shacl/ – UninformedUser Oct 23 '20 at 15:20
  • Thanks for you answer :) – fandrale Oct 23 '20 at 16:25

0 Answers0