Questions tagged [shacl]

Use this tag on questions concerning the Shapes Constraint Language for RDF: SHACL.

SHACL is a language for validating RDF graphs against a set of conditions. These conditions are also expressed in the form of RDF graphs, called "shapes". Beyond validation, shapes may facilitate user interface building, code generation, and data integration.

117 questions
2
votes
1 answer

Multiple paths and existential quantification in SHACL rules (should I use sh:oneOrMorePath perhaps?)

I would like to understand how to handle multiple paths and existential quantification in SHACL rules. Let me exemplify my problem with a sample ontology. The ontology includes the classes "Approve", "Legal", "Result", "Man", and "Machine", all…
2
votes
1 answer

SHACL equivalent of JSON-Schema "uniqueItems"

So I'm tasked with converting a JSON-Schema describing an ontology to SHACL. JSON-Schema has the uniqueItems construct, which, as the name suggests, forces all elements in an array to be unique. For my purposes, only elements of type String are…
Dzeri96
  • 196
  • 2
  • 13
2
votes
0 answers

Is it possible to describe a Singleton Property with SHACL?

Is it possible to describe Singleton Properties in SHACL? That is, instead of requiring a single foaf:name on a foaf:Person there’s a requirement of a unique predicate that that has a rdf:singletonPropertyOf of foaf:name. So in @prefix foaf:…
2
votes
0 answers

What is the effect of closing a PropertyShape?

In the SHACL specification, as far as I can see, nothing forbids closing a PropertyShape. The following is the default example from the SHACL Playground, with the default errors corrected, so the data is valid. Shapes: @prefix dash:…
fkleedorfer
  • 525
  • 4
  • 8
2
votes
1 answer

Can SHACL shape target any subject in a graph?

Can SHACL shape target any subject in the validated graph? The only solution that comes to mind is to use reasoning to infer that everything is owl:Thing and use sh:targetClass owl:Thing.
Jindřich Mynarz
  • 1,563
  • 1
  • 16
  • 31
2
votes
1 answer

SPARQL CONSTRUCT to generate RDF collection from GROUP BY bindings

I would like to generate an RDF collection (i.e. rdf:first/rdf:rest linked list) using a SPARQL construct query, putting all grouped bindings for a variable into one collection. So for the data @prefix ex: . ex:example1 a …
fkleedorfer
  • 525
  • 4
  • 8
2
votes
2 answers

How to create a SHACL rule to infer rdf:type from rdfs:subClassOf

In order to validate my RDF graph against my SHACL validation shapes V, I want to infer some triples to keep my shapes simple. In particular, one of the rule I need to implement is (in pseudo code): (?s, rdf:type, :X) <-- (?s, rdfs:subClassOf,…
2
votes
1 answer

Can SHACL validate JSON-LD containing a list of objects?

I'm looking to validate the following JSON-LD using SHACL: { "@context" : { "day" : { "@id" : "test:day" }, "month" : { "@id" : "test:month" }, "myList" : { "@id" : "test:myList" }, "year" : { …
Jacob G.
  • 28,856
  • 5
  • 62
  • 116
2
votes
1 answer

Can SHACL express constraints about the entire data scope?

Is it possible to use SHACL to formulate constraints about the entire data scope? For example, can I require the presence of a triple conforming to a certain shape in the data? A code example of what I had in mind: # DEMO code, currently raises an…
2
votes
1 answer

SHACL Validation Error for External Resources

I have a SHACL schema that is written to validate research variables. { "@id": "m:VariableShape", "@type": "sh:NodeShape", "targetClass": "pplan:Variable", "property": [ { "path": "m:dataType", "class" : "rdfs:Datatype", …
Ehsan
  • 561
  • 1
  • 6
  • 21
2
votes
1 answer

SHACL with Jena, how to get the Model after SPARQL CONSTRUCT from the shape?

I have this data file: @prefix ex: . ex:John a ex:Person ; a ex:parent ; a ex:male . And this shape file: @prefix rdf: . @prefix rdfs: …
1
vote
0 answers

How can I nest my list of blank nodes rather than have each one in a different graph

Fuseki returns this from my DESCRIBE query: { "@graph": [ { "@id": "ex:LE-propertyShape", "sh:or": { "@list": [ { "@id": "_:b3" }, { "@id": "_:b1" } ] …
agustaf
  • 683
  • 1
  • 6
  • 19
1
vote
1 answer

GraphDB rejecting the OGC GeoSparql SHACL

Question: Why is GraphDB rejecting the OGC GeoSparql SHACL constraints? Background GraphDB supports SHACL validation against incoming & existing data. OGC provides shapes for the GeoSparql standard and included passing & non-passing data in the…
Thomas
  • 720
  • 9
  • 22
1
vote
1 answer

SHACL check a graph for nodes of types other than a predefined set of types

Every SHACL statement has to have a target. I have written SHACL schema for every node type I have, but that doesn't check for extra nodes of "unknown to SHACL" types in the graph. I am looking to target all nodes to make sure they are all of a type…
Natalia Zoń
  • 980
  • 2
  • 12
  • 22
1
vote
0 answers

Validating neo4j graph using SHACL, when a relationship can lead to a node belonging to one of two specific types

I have the following graph in neo4j (the below is a Cypher query that creates it). CREATE (banana:Fruit {name:'Banana'}) CREATE (apple:Fruit {name:'Apple'}) CREATE (fruit_salad:Dish {name:'Fruit Salad'}) CREATE (banana_gun:Weapon {name:'Banana…
Natalia Zoń
  • 980
  • 2
  • 12
  • 22