Skip to content

Instantly share code, notes, and snippets.

@afs
Created December 24, 2023 11:08
Show Gist options
  • Save afs/909977164a6baab961d704b5b978014f to your computer and use it in GitHub Desktop.
Save afs/909977164a6baab961d704b5b978014f to your computer and use it in GitHub Desktop.
@prefix dash: <https://m59iikxw1z.proxynodejs.usequeue.com/dash#> .
## @prefix owl: <https://nt6nqxrxfq.proxynodejs.usequeue.com/2002/07/owl#> .
@prefix rdf: <https://nt6nqxrxfq.proxynodejs.usequeue.com/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <https://nt6nqxrxfq.proxynodejs.usequeue.com/2000/01/rdf-schema#> .
@prefix sh: <https://nt6nqxrxfq.proxynodejs.usequeue.com/ns/shacl#> .
## @prefix tosh: <https://fe3j0qtpik.proxynodejs.usequeue.com/tosh#> .
## @prefix xsd: <https://nt6nqxrxfq.proxynodejs.usequeue.com/2001/XMLSchema#> .
dash:ListNodeShape
a sh:NodeShape ;
rdfs:comment "Defines constraints on what it means for a node to be a node within a well-formed RDF list. Note that this does not check whether the rdf:rest items are also well-formed lists as this would lead to unsupported recursion." ;
rdfs:label "List node shape" ;
sh:or (
[
sh:hasValue () ;
sh:property [
a sh:PropertyShape ;
sh:path rdf:first ;
sh:maxCount 0 ;
] ;
sh:property [
a sh:PropertyShape ;
sh:path rdf:rest ;
sh:maxCount 0 ;
] ;
]
[
sh:not [
sh:hasValue () ;
] ;
sh:property [
a sh:PropertyShape ;
sh:path rdf:first ;
sh:maxCount 1 ;
sh:minCount 1 ;
] ;
sh:property [
a sh:PropertyShape ;
sh:path rdf:rest ;
sh:maxCount 1 ;
sh:minCount 1 ;
] ;
]
) ;
.
dash:ListShape
a sh:NodeShape ;
rdfs:comment """Defines constraints on what it means for a node to be a well-formed RDF list.
The focus node must either be rdf:nil or not recursive. Furthermore, this shape uses dash:ListNodeShape as a \"helper\" to walk through all members of the whole list (including itself).""" ;
rdfs:label "List shape" ;
sh:or (
[
sh:hasValue () ;
]
[
sh:not [
sh:hasValue () ;
] ;
sh:property [
a sh:PropertyShape ;
sh:path [
sh:oneOrMorePath rdf:rest ;
] ;
dash:nonRecursive true ;
] ;
]
) ;
sh:property [
a sh:PropertyShape ;
sh:path [
sh:zeroOrMorePath rdf:rest ;
] ;
rdfs:comment "Each list member (including this node) must be have the shape dash:ListNodeShape." ;
sh:node dash:ListNodeShape ;
] ;
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment