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
1
vote
1 answer

RDF4j Shacl validation gives different results for Turtle and JSON-LD

I have a problem with RDF4J SHACL validation engine. This is my code where I use shacl rules and example payload files as TTL input: String SHAPES = "rules.ttl"; String DATA = "input.ttl"; ShaclSail shaclSail = new ShaclSail(new…
Krzysztof Majewski
  • 2,494
  • 4
  • 27
  • 51
1
vote
0 answers

RDF vocabulary to specify a RDF resource IRI's structure

I would like to encode how an IRI of a RDF resource should be constructed, also including the literals of the resource predicates. For example take this RDF resource <> a :Dataset ; :published "2020-01-01"^^xsd:date ; :name "testDataset" . How…
Nope
  • 153
  • 1
  • 6
1
vote
2 answers

Use SHACL to validate a date within a certain range

How can I use SHACL to validate if a date lies within a certain range? I tried using minInclusive, maxInclusive, minExclusive, maxExcluse and lessThan, but nothing seems to work. I am using the SHACL Playground with this data. Shapes Graph @prefix…
NewMarc
  • 86
  • 6
1
vote
0 answers

OWL - associate transitive child with great-parent

I would like to simplify my SHACL definitions by reversing the relations between shapes, properties and groups. A typical NodeShape looks like this. Two properties in a group: <> a sh:NodeShape ; sh:property [ sh:name "Property 1" ; …
Tomasz Pluskiewicz
  • 3,622
  • 1
  • 19
  • 42
1
vote
1 answer

How to programmatically read the details of a SHACL shapes graph in Jena?

Let's say I have the following shapes graph camo:exampleShape a sh:NodeShape; sh:targetClass cm:Moving; sh:property [ a sh:PropertyShape; sh:path cm:dofNumber ; sh:minInclusive 1; ] . This shapes file is…
user0221441
  • 368
  • 4
  • 11
1
vote
1 answer

Can not see name of objects or prefixes in my generated lang.TRIG or lang.NQUADS file

I have a datatset and I create a ttl file after any changement of my dataset. The output of my file after using is something like : RDFDataMgr.write(System.out, dataset, Lang.TRIG);
N.Omar
  • 29
  • 6
1
vote
2 answers

SHACL: Require sh:property to be a URI

I was wondering if there's a way to specify that a given sh:property is expected to have a value of a URI without any particular class. In the example SHACL below, the property meta:value would only allow URIs, although I don't know of a way to…
Neil Graham
  • 593
  • 1
  • 5
  • 17
1
vote
1 answer

How to construct a list in SPARQL

I have a ttl file that looks like this: ex:Shape1 a sh:NodeShape ; sh:property ex:Property-1 rdfs:label "Shape 1" ex:Property-1 a sh:PropertyShape ; sh:path ex:property1 sh:in ( "Option 1" "Option 2" ) ; …
agustaf
  • 683
  • 1
  • 6
  • 19
1
vote
1 answer

Impossible to define restriction inheritance in SHACL shapes graph, only in data graph?

I am struggling to understand (for me) a very unintuitive feature regarding the inheritance of shape constraints. My problem is that when i try to inherit shape constraints via rdfs:subClassOf, this works only when the inheritance is specified in…
O-U-O
  • 69
  • 5
1
vote
1 answer

SHACL validate existing domain and range definitions?

I want to validate the existing rdfs:domain and rdfs:range statements of an existing ontology and knowledge base with SHACL. However it seems like it is extremely verbose to do that with SHACL. Existing Definition :prop1 a owl:ObjectProperty; …
Konrad Höffner
  • 11,100
  • 16
  • 60
  • 118
1
vote
1 answer

Why does sh:NodeShape not have sh:name and sh:description properties?

When reading the SHACL specification I noticed we can add a sh:name and sh:description to a sh:PropertyShape which is meant to provide human-readable labels for the property in the target where it appears which is really cool for properties but I…
Natan Cox
  • 1,495
  • 2
  • 15
  • 28
1
vote
1 answer

Why this SHACL validation does not work as expected?

Here is my shacl.ttl: @prefix ex: . @prefix rdf: . @prefix sh: . ex:paintNodeShape rdf:type…
joylix
  • 95
  • 7
1
vote
0 answers

Shacl Specification Error or just confusing, i am missing something?

Taken from the specification: A node shape is a shape in the shapes graph that is not the subject of a triple with sh:path as its predicate. SHACL instances of sh:NodeShape cannot have a value for the property sh:path. Yet when talking about Or…
MaatDeamon
  • 9,532
  • 9
  • 60
  • 127
1
vote
1 answer

Combining sh:in and sh:pattern to find placeholders in definitions

I'm trying to make a property shape that can discern between a "real" definition and a placeholder for a definition as a value for skos:definition. My input tends to contain things like "", "N/A", "N.A.", "None" etc. in the definition field, and…
Robin
  • 135
  • 10
1
vote
0 answers

How to compare individuals through two paths in SHACL?

This questions is related to the one at this link. Let's say it is an "extended question". The ontology at that link contains the following individuals: :a rdf:type :Approve ; :has-theme :r1,:r2 . :r1 rdf:type :Result ; :come-from :m1 . :r2…