AKSW / RDFUnit

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

There is a problem with maxCount ? #116

Closed BorderCloud closed 2 years ago

BorderCloud commented 2 years ago

Expected Behavior

No error

Actual Behavior

The RDFUnit report gives me: ERROR | Maximum cardinality for <http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Organization#signature> is "1"^^<http://www.w3.org/2001/XMLSchema#integer> | http://daap.dsi.universite-paris-saclay.fr/wiki/Lip(Sys)2 | urn:uuid:6584ae0a-dc9d-4b71-8c2e-c835c90263f4

Without the line with sh:maxCount in the shape, the error disappears.

Steps to Reproduce the Problem

With:

sh:maxCount 1

For example: https://daap.dsi.universite-paris-saclay.fr/wiki/Data:Organization I have to disable all "sh:maxCount".

Specifications

jimkont commented 2 years ago

Thanks for the report, could you please send a sample of instance data that fail with this shape?

Technically, each constraint (e.g. maxCount, datatype) is evaluated independently of other constraints and combinations should not have side effects. I suspect there is some issue with the data that you are trying to validate but need to take a look at some passing/failing nodes

BorderCloud commented 2 years ago

You can download these files:

After, you can enable the constraint maxCount in the file "Organization":

sh:property [
      rdfs:label "signature"^^xsd:string ;
      sh:datatype xsd:string ;
      sh:minCount 1 ;
      sh:maxCount 1 ;
      sh:path <signature> ;
    ] ;

I hope, you can reproduce this problem. Thanks.

jimkont commented 2 years ago

tried the following limited example

schema.ttl

BASE <http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Organization#>

prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix sh: <http://www.w3.org/ns/shacl#>
prefix vcard: <http://www.w3.org/2006/vcard/ns#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>

<Organization>
  a owl:Class ;
  rdfs:label "Organization"@en ;
  rdfs:label "Organisation"@fr ;
  rdfs:subClassOf vcard:Organization.

<Organization>
  a sh:NodeShape ;
  sh:targetClass <Organization> ;

  sh:property [
      rdfs:label "signature"^^xsd:string ;
      sh:datatype xsd:string ;
      sh:minCount 1 ;
      sh:maxCount 1 ;
      sh:path <signature> ;
    ] .

<signature>
  rdf:type rdf:Property ;
  rdfs:label "Official signature of this project in the publication"^^xsd:string 
.

data.ttl


BASE <http://daap.dsi.universite-paris-saclay.fr/wiki/Lip(Sys)2>

prefix daap: <http://daap.dsi.universite-paris-saclay.fr/wiki/>
prefix daapo: <http://daap.dsi.universite-paris-saclay.fr/wiki/Data:Organization#>
prefix user: <http://daap.dsi.universite-paris-saclay.fr/wiki/User:>

prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix vcard: <http://www.w3.org/2006/vcard/ns#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix wd: <http://www.wikidata.org/entity/>

<> #fix the problem with parenthesis 
  rdf:type daapo:Laboratory ;
  rdfs:label "Lip(Sys)²" ;
  rdfs:label "Lip(Sys)²"@en ;
  rdfs:label "Lip(Sys)²"@fr ;
  daapo:contact user:Pierre_Chaminade ;
  daapo:signature "Lip(Sys)²- Chimie Analytique Pharmaceutique, Univ. Paris-Sud, Université Paris-Saclay, F-92290 Châtenay-Malabry, France" ;
  rdfs:seeAlso  <http://www.lipsys2.universite-paris-saclay.fr/> ;
  daapo:item wd:Q2346 ;
  daapo:item wd:Q6556376 
.

and running

./bin/rdfunit -d {full-path}/data.ttl -s {full-path}/schema.ttl -r shacl -o turtle

does not return any error. Can you send a similar small example where the constraints fail to try and debug the problem?

BorderCloud commented 2 years ago

Good news... Me too. Yesterday, I fixed one hundred errors. This morning I tested with all rules maxCount and now, the problem has disappeared. It's probably a side effect when there are a lot errors... Sorry for the inconvenience.