AKSW / RDFUnit

An RDF Unit Testing Suite
http://RDFUnit.aksw.org
Apache License 2.0
153 stars 40 forks source link

Object in blank node of testCase is artificial for SHACL NodeShapes #121

Open TBoonX opened 2 years ago

TBoonX commented 2 years ago

Expected Behavior

When using SHACL as manual written test cases, the predicate testCase should link to the SHACL NodeShape.

Actual Behavior

Example:

rut:testCase [ a <urn:uuid:57cd8615-c40e-403a-b186-ffad62238c64> ] ;

While the NodeShape is

<https://github.com/AKSW/rdf-maturitylevel-pipeline/Metadata/OntologyShape>

For ManualTestCase it does link to the existing URI.

Steps to Reproduce the Problem

  1. Write a basic NodeShape
  2. Execute RDFUnit with some data java -jar /app/rdfunit-validate.jar -A -v -d ./data.ttl -s shape.ttl -r shacl -o turtle -C -f /tmp/
  3. Print result file

Specifications

latest aksw/rdfunit docker image on docker hub.

jimkont commented 2 years ago

thanks for the reposrt, can you post an example input of a shapes/data graph that showcases the problem?

TBoonX commented 2 years ago

data.ttl:

@prefix :           <http://stream-ontology.com/matvoc-core/> .
@prefix rdf:        <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:       <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:        <http://www.w3.org/2002/07/owl#> .
@prefix xsd:        <http://www.w3.org/2001/XMLSchema#> .
@prefix dc:         <http://purl.org/dc/elements/1.1/> .
@prefix xml:        <http://www.w3.org/XML/1998/namespace> .
@prefix foaf:       <http://xmlns.com/foaf/0.1/> .
@prefix emmo:       <http://stream-ontology.com/matvoc-emmo> .
@prefix skos:       <http://www.w3.org/2004/02/skos/core#> .
@prefix dcat:       <http://www.w3.org/ns/dcat#> .
@prefix vann:       <http://purl.org/vocab/vann/> .
@prefix bibo:       <http://purl.org/ontology/bibo/> .
@prefix schema: <http://schema.org/> .
@prefix dcterms:    <http://purl.org/dc/terms/> .

<http://stream-ontology.com/matvoc-core/> rdf:type owl:Ontology ;
    dc:title "Materials Vocabulary: MatVoc-Core"@en;
    dc:description "The Materials RDF vocabulary, described using W3C RDF Schema and the Web Ontology Language to satisfy the requirements of the STREAM project."@en ;
    vann:preferredNamespaceUri "http://stream-ontology.com/" ;
    vann:preferredNamespacePrefix "mvc"@en ;
    bibo:status "Draft"@en ;
    schema:schemaVersion "1.0.0" ;
    dc:creator "Javad Chamanara", "Tatyana Sheveleva" ;
    dcterms:contributor <https://aksw.org/KurtJunghanns> ;
    dcterms:license "MIT License"@en ;
    rdfs:seeAlso <https://stream-projekt.net> .

shape.ttl:

@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rlog:    <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#> .
@prefix rutg: <http://rdfunit.aksw.org/data/generators#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rut: <http://rdfunit.aksw.org/ns/core#> .
@prefix rutp: <http://rdfunit.aksw.org/data/patterns#> .
@prefix rutt: <http://rdfunit.aksw.org/data/tests#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix vann: <http://purl.org/vocab/vann/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix rutt: <https://github.com/AKSW/rdf-maturitylevel-pipeline/Metadata/> .
@prefix : <https://github.com/AKSW/rdf-maturitylevel-pipeline/maturitymodel/> .

rutt:OntologyShape a sh:NodeShape ;
  sh:targetClass owl:Ontology ;
  rdfs:comment "A NodeShape for minimal content we expect to describe an Ontology." ;
  sh:property [
    sh:path rdfs:label ;
    sh:minCount 1 ;
  ] ;
  rdfs:seeAlso :M4 .

Result:

@prefix schema: <http://schema.org/> .
@prefix dsp:   <http://dublincore.org/dc-dsp#> .
@prefix rutg:  <http://rdfunit.aksw.org/data/generators#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix rlog:  <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rutp:  <http://rdfunit.aksw.org/data/patterns#> .
@prefix oslc:  <http://open-services.net/ns/core#> .
@prefix rut:   <http://rdfunit.aksw.org/ns/core#> .
@prefix rutr:  <http://rdfunit.aksw.org/data/results#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sh:    <http://www.w3.org/ns/shacl#> .
@prefix rutt:  <http://rdfunit.aksw.org/data/tests#> .
@prefix ruts:  <http://rdfunit.aksw.org/data/testsuite#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix prov:  <http://www.w3.org/ns/prov#> .
@prefix dc:    <http://purl.org/dc/elements/1.1/> .

<urn:uuid:72395bc5-5b86-44af-aa94-00b42e909958>
        a                          sh:ValidationReport , prov:Activity , rut:TestExecution ;
        rut:executionType          "shaclTestCaseResult" ;
        rut:source                 <./data.ttl> ;
        rut:testsError             "0"^^xsd:nonNegativeInteger ;
        rut:testsFailed            "1"^^xsd:nonNegativeInteger ;
        rut:testsRun               "1"^^xsd:nonNegativeInteger ;
        rut:testsSuceedded         "0"^^xsd:nonNegativeInteger ;
        rut:testsTimeout           "0"^^xsd:nonNegativeInteger ;
        rut:totalIndividualErrors  "1"^^xsd:nonNegativeInteger ;
        prov:endedAtTime           "2022-07-19T13:13:32.707Z"^^xsd:dateTime ;
        prov:startedAtTime         "2022-07-19T13:13:32.658Z"^^xsd:dateTime ;
        prov:wasAssociatedWith     <./shacl.ttl> ;
        prov:wasStartedBy          <http://localhost/> ;
        sh:conforms                false ;
        sh:result                  <urn:uuid:72395bc5-5b86-44af-aa94-00b42e909958/14f77792-a6f0-47ff-a1da-dbbd83bae81c> .

<urn:uuid:72395bc5-5b86-44af-aa94-00b42e909958/14f77792-a6f0-47ff-a1da-dbbd83bae81c>
        a                             rut:TestCaseResult , sh:ValidationResult ;
        dcterms:date                  "2022-07-19T13:13:32.702Z"^^xsd:dateTime ;
        rut:testCase                  [ a  <urn:uuid:97438244-4950-43f4-bcd3-66d1683c4f90> ] ;
        prov:wasGeneratedBy           <urn:uuid:72395bc5-5b86-44af-aa94-00b42e909958> ;
        sh:focusNode                  <http://stream-ontology.com/matvoc-core/> ;
        sh:message                    "Minimum cardinality for <http://www.w3.org/2000/01/rdf-schema#label> is \"1\"^^<http://www.w3.org/2001/XMLSchema#integer>" ;
        sh:resultMessage              "Minimum cardinality for {$PATH} is {$minCount}" ;
        sh:resultPath                 rdfs:label ;
        sh:resultSeverity             sh:Violation ;
        sh:severity                   rlog:ERROR ;
        sh:sourceConstraintComponent  sh:MinCountConstraintComponent ;
        sh:sourceShape                []  .