SHACL constraint on set of URI (sub)patterns

Hi all,

I have a dataset with URIs in the subject position of triples as follows:

<http://example.com/mydata/1> p o
<http://example.com/mydata/2> p o
<http://example.com/mydata/3> p o
...

I would like to express the following constraints on all subject URIs:

1) The value of the URI pattern after "<http://example.com/mydata/" must
always be an integer (in the example 1, 2 or 3
2) The integer must be more than zero and less than the number of the
subject URIs. That is, the third triple from the below would be invald:
<http://example.com/mydata/1> p o
<http://example.com/mydata/2> p o
<http://example.com/mydata/4> p o # this should  have been 3

I tried to express this via  SPARQL constraint, but did not succeed. Any
hints on how to  express via SHACL would be nice - thanks.

As some background for the use case: I am generating the URIs in an
automated fashion and want to assure that the generation always follows the
above constraints, to assure that after the generation no existing URI is
"lost" and to assure that new URis follow the pattern described above.

Regards,

Felix

Received on Tuesday, 18 June 2019 05:32:12 UTC