labra / ShExcala

ShEx expressions in Scala
http://labra.github.io/ShExcala/
MIT License
11 stars 3 forks source link

Stackoverflow on inverse properties validation #4

Closed chemaar closed 10 years ago

chemaar commented 10 years ago

A stackoverflow exception is thrown when inverse properties are being validated. An example is attached below:

Turtle data:

@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 skos: http://www.w3.org/2004/02/skos/core#. @prefix : http://example.org/.

:MyConcept rdf:type skos:Concept, owl:Class, owl:ObjectProperty . :MyConcept skos:inScheme :MyScheme. :MyConcept skos:topConceptOf :MyScheme.

:MyScheme rdf:type skos:ConceptScheme, owl:Class, owl:ObjectProperty.

:MyScheme skos:hasTopConcept :MyConcept.

Shex rules:

prefix : http://example.org/ 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 skos: http://www.w3.org/2004/02/skos/core# prefix foaf: http://xmlns.com/foaf/0.1/ prefix xsd: http://www.w3.org/2001/XMLSchema# prefix shex: http://www.w3.org/2013/ShEx/ns#

start = # A scheme concept validation starts with

{ # An skos:Concept has: rdf:type (skos:Concept owl:Class owl:ObjectProperty)+, # type which is skos:Concept or/and OWL:Class skos:inScheme @_, # and belongs to 0..n concept schemes, skos:topConceptOf @_ # and can be top concept of 0..n schemes } { #An skos:Concept Scheme has: rdf:type (skos:ConceptScheme owl:Class owl:ObjectProperty)+, # type which is skos:ConceptScheme or/and owl:Class or/and owl:ObjectProperty skos:hasTopConcept @\* # and has 0..n top skos:Concept } and the results of the W3C validator: http://www.w3.org/2013/ShEx/FancyShExDemo?starting-node=%3Chttp%3A%2F%2Fexample.org%2FMyConcept%3E&schema=prefix%20%3A%20%20%20%20%20%3Chttp%3A%2F%2Fexample.org%2F%3E%0Aprefix%20rdf%3A%20%20%20%20%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0Aprefix%20rdfs%3A%20%20%20%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%20%0Aprefix%20owl%3A%20%20%20%20%20%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23%3E%20%0Aprefix%20skos%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E%0Aprefix%20foaf%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0Aprefix%20xsd%3A%20%20%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0Aprefix%20shex%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2013%2FShEx%2Fns%23%3E%0A%0Astart%20%3D%20%3CSkosConceptShape%3E%20%20%23%20A%20scheme%20concept%20validation%20starts%20with%20%3CSkosConceptShape%3E%0A%0A%3CSkosConceptShape%3E%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09%09%23%20An%20skos%3AConcept%20has%3A%0A%20rdf%3Atype%20(skos%3AConcept%20owl%3AClass%20owl%3AObjectProperty)%2B%2C%20%23%20type%20which%20is%20skos%3AConcept%20or%2Fand%20OWL%3AClass%0A%20skos%3AinScheme%20%09%09%40%3CSkosConceptSchemeShape%3E*%2C%09%09%09%09%09%23%20and%20belongs%20to%200..n%20concept%20schemes%2C%20%20%20%0A%20skos%3AtopConceptOf%20%09%40%3CSkosConceptSchemeShape%3E*%09%09%09%09%09%23%20and%20can%20be%20top%20concept%20of%200..n%20schemes%0A%7D%0A%0A%3CSkosConceptSchemeShape%3E%20%7B%20%09%09%09%09%20%20%23An%20skos%3AConcept%20Scheme%20has%3A%0A%20rdf%3Atype%20(skos%3AConceptScheme%20owl%3AClass%20owl%3AObjectProperty)%2B%2C%20%23%20type%20which%20is%20skos%3AConceptScheme%20or%2Fand%20owl%3AClass%20or%2Fand%20owl%3AObjectProperty%0A%20skos%3AhasTopConcept%20%40%3CSkosConceptShape%3E*%09%20%20%23%20and%20has%200..n%20top%20skos%3AConcept%0A%7D&data=%40prefix%20rdf%3A%20%20%20%20%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%20.%0A%40prefix%20rdfs%3A%20%20%20%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%20.%0A%40prefix%20owl%3A%20%20%20%20%20%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23%3E%20.%0A%40prefix%20skos%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E.%0A%40prefix%20%3A%20%3Chttp%3A%2F%2Fexample.org%2F%3E.%0A%0A%3AMyConcept%20rdf%3Atype%20skos%3AConcept%2C%20owl%3AClass%2C%20owl%3AObjectProperty%20.%0A%3AMyConcept%20skos%3AinScheme%20%3AMyScheme.%0A%3AMyConcept%20skos%3AtopConceptOf%20%3AMyScheme.%0A%0A%3AMyScheme%20rdf%3Atype%20skos%3AConceptScheme%2C%20owl%3AClass%2C%20owl%3AObjectProperty.%0A%0A%3AMyScheme%20skos%3AhasTopConcept%20%3AMyConcept.%0A
labra commented 10 years ago

There was a bug in the validation algorithm that has been solved in version 0.0.7.