Hey guys, i created an Issue one weeg ago and you recommended me to validate my schema with jena shacl. I did this, but i still don't get the expected result... What do i have to change or what mistake did i do ? (i am not allowed to change the schema by the way). Maybe you have some example code or another idea how to validate my metadata.rdf ?
The problem: As you can see, i have a "topic" containing the property "has-component", but my schema just allows (rdfs:domain and rdfs:range) a "component" with the property "has-component". The validation report says in both ways, that everything is confirm...... Thanks for you help:) Greetings from Germany Alex My schema is original an .rdf-schema, but i converted it into .ttl in order to use shacl-shapes. It looks like the following: schema.ttl: @prefix schema: <http://schema.org/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix iirds: <http://iirds.tekom.de/iirds#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . iirds:Topic a rdfs:Class ; rdfs:comment "A topic is a unit of information covering a single subject."@en ; rdfs:label "Topic"@en , "Topic"@de ; rdfs:subClassOf iirds:InformationUnit ; iirds:description "IRI: required"@en , "The resource of a topic is a file in the iiRDS package."@en . iirds:has-component a rdf:Property ; rdfs:comment "Relates to a component that is part of another component."@en , "Verweist auf eine Kompoente, die Teil einer anderen Komponente ist."@de ; rdfs:domain iirds:Component ; rdfs:label "has component"@en , "hat Komponente"@de ; rdfs:range iirds:Component ; rdfs:subPropertyOf iirds:iirdsRelationConcept ; iirds:description "Cardinality: http://iirds.tekom.de/iirds#Component [0..*]"@en , ""@en ; schema:domainIncludes iirds:Component ; schema:rangeIncludes iirds:Component . iirds:Component a rdfs:Class ; rdfs:comment "Describes a component of the technical system that the documentation refers to."@en ; rdfs:label "Component"@en , "Komponente"@de ; rdfs:subClassOf iirds:ProductMetadata ; iirds:description "IRI: required"@en , "Components may have relations to ot[...] The iirds#Component may also be used as a docking point for external component definitions."@en . My metadata.rdf converted into metadata.ttl looks like the following: metadata.ttl: @prefix pifan: <http://customer.docufy.de/pifan#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix iirds: <http://iirds.tekom.de/iirds#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . [...] <http://iirds.docufy.de/topics/05d2c8268b68ff6444a49358ca7fe925/1/de-de> a iirds:Topic ; iirds:dateOfCreation "2020-08-06T12:24:07.285+02:00"@de-de ; iirds:has-component <http://iirds.docufy.de/metadata/85e7506eb2e33f90c0a802687f559f0c> ; iirds:relates-to-component <http://iirds.docufy.de/metadata/85e7506eb2e33f90c0a802687f559f0c> ; iirds:relates-to-product-feature <http://iirds.docufy.de/metadata/b63e4b15b2dc2d83c0a8026877f6aa88> , <http://iirds.docufy.de/metadata/10b4c299b2ddae19c0a8026824aa7410> , <http://iirds.docufy.de/metadata/dbbb7334b2e2a9e5c0a8026860d20c17> ; iirds:title "Kontaktdaten"@de-de . [...] My code is the following: //try with jena shacl Graph shapesGraph = RDFDataMgr.loadGraph("schema.ttl"); Graph dataGraph = RDFDataMgr.loadGraph("metadata.ttl"); Shapes shapes = Shapes.parse(shapesGraph); ValidationReport report = ShaclValidator.get().validate(shapes, dataGraph); ShLib.printReport(report); System.out.println(); RDFDataMgr.write(System.out, report.getModel(), Lang.TTL); //try with topbraid shacl Model dataModel = org.topbraid.jenax.util.JenaUtil.createDefaultModel(); dataModel.read("metadata.ttl"); Model shapeModel = org.topbraid.jenax.util.JenaUtil.createDefaultModel(); shapeModel.read("schema.ttl"); Resource reportResource = ValidationUtil.validateModel(dataModel, shapeModel, true); File reportFile = new File("report.ttl");
