W3C home > Mailing lists > Public > public-rdf-shapes@w3.org > September 2016

Validating instances based on other instances

From: Miika Alonen <miika.alonen@csc.fi>
Date: Mon, 26 Sep 2016 18:34:05 +0300 (EEST)
To: public-rdf-shapes@w3.org
Message-ID: <1039762350.181616.1474904045047.JavaMail.zimbra@csc.fi>
Hi all, 

Question about how to validate instance literals (or irirefs) based on other instance values. 

I have a use case where i have literals that should be same as some other literals, for example: 

VALID DATA: 

ex:Dataset ex:identifier "doi:10.3972/example.0145.db" . 

ex:Document ex:related "doi:10.3972/example.0145.db" . 


INVALID DATA: 

ex:Dataset ex:identifier "doi:10.3972/example.0145.db" . 

ex:Document ex:related "doi:null" . 


Is there other ways to validate this than Sparql constraints. I know i could do something like: 

<http://example.com/ns#> sh:prefix "ex" . 

ex:DocumentShape 
a sh:Shape ; 
sh:targetClass ex:DocumentType ; 
sh:sparql [ 
sh:message "Values must be dataset identifiers" ; 
sh:select """ 
SELECT $this ?value 
WHERE { 
$this ex:related ?value . 
?identifier ex:identifier ?value . 
} 
""" ; 
] . 

ETC ... but sparql seems bit overkill and it is hard to write. Is there or could there be other ways to produce these queries? For example property paths where first resource would be the starting point of the property path, eg: 

sh:DocumentShape 
a sh:Shape . 
sh:targetClass ex:DocumentType ; 
sh:property [ 
sh:predicate ex:related ; 
sh:equals ( ex:DatasetType ex:identifier ); 
] . 


- Miika 
Received on Monday, 26 September 2016 15:34:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:02:44 UTC