I am trying to write a SHACL shape for RDF data graph validation. I am having a bit of confusion about which namespace is used for declaring the name of the shape. I saw the SHACL documentation. The following namespaces are declared in it.
rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: http://www.w3.org/2000/01/rdf-schema#
sh: http://www.w3.org/ns/shacl#
xsd: http://www.w3.org/2001/XMLSchema#
ex: http://example.com/ns#
While writing the shape, they used 'ex' as the namespace for declaring the name of the shape as follows:
ex:PersonShape
a sh:NodeShape ;
sh:targetClass ex:Person ; # Applies to all persons
sh:property [ # _:b1
sh:path ex:ssn ; # constrains the values of ex:ssn
sh:maxCount 1 ;
sh:datatype xsd:string ;
sh:pattern "^\\d{3}-\\d{2}-\\d{4}$" ;
]
I am not sure how is it decided which namespace is to be used for declaring the name of the shape. Could anyone guide me on this please?
Thanks, Ajay
As IS4 mentioned, the namespace isn't super important, but if you wanted to use your ontology's namespace - no one would complain. It's common to combine both ontology and shapes together in the same file, which is where this practice makes more sense.