- From: Rashmi Burse <rashmi.burse@ucdconnect.ie>
- Date: Mon, 14 Mar 2022 17:22:17 +0000
- To: public-shacl@w3.org
- Message-ID: <CAGaQz-ggWDk_-YaovfFsK7n6hOMObFxLVewA+egDGxdJ75qssw@mail.gmail.com>
Hi, I want to implement the following scenario: Firstly, I want to create custom targets for a NodeShape in such a way that these targets should change based on the current focusNode. For example, if the focusNode is snomed: 24078009 then the custom targets should be snomed: 24078009_3, snomed: 24078009_5, snomed: 24078009_6; If the focusNode is snomed: 1003505005 then the custom targets for the same nodeShape should be changed to snomed:1003505005_1, snomed:1003505005_2. In order to implement this I want to refer to the current focusNode inside the SPARQLTarget query. However I am not sure how to use sh:this inside sh:select. Secondly, for each (focusNode specific) list of custom targets returned by the targetSPARQL query, I want to create a union of all the properties in those targets, i.e., union of rdf classes (snomed: 24078009_3, snomed: 24078009_5, snomed: 24078009_6) for the focusNode snomed: 24078009 and then check if the condition mentioned in the nodeShape is satisfied for the union of those custom targets and not just an individual custom target. Here is my nodeShape and datagraph: *#shacl custom target shape* snomed: sh:declare [ sh:prefix "snomed" ; sh:namespace "http://localhost:8890/snomed/"^^xsd:anyURI ; ] . snomed:dob363698007Shape a sh:NodeShape ; sh:target [ a sh:SPARQLTarget ; sh:prefixes snomed: ; sh:select "SELECT ?this WHERE { ?node a snomed:24078009. ?node snomed:609096000 ?this . ?this a snomed:dob363698007 .}"; ] ; sh:property [ sh:path snomed:363698007; sh:minCount 1; ]. *Data Graph:* snomed:dob a rdfs:Class,snomed:dob ; rdfs:label "Semantic Pattern dob"^^xsd:string ; snomed:609096000 snomed:dob363698007 . snomed:dob363698007 a rdfs:Class,snomed:dob363698007; snomed:363698007 snomed:123037004 . snomed:24078009 a rdfs:Class, snomed:24078009, snomed:dob; rdfs:label "Gangosa of yaws (disorder)"^^xsd:string ; snomed:609096000 snomed:24078009_3,snomed:24078009_5,snomed:24078009_6; rdfs:subClassOf snomed:128349005, snomed:140004, snomed:177010002, snomed:312118003, snomed:312129004, snomed:312422001, snomed:363166002, snomed:47841006, snomed:88037009 . snomed:24078009_3 a rdfs:Class, snomed:24078009_3, snomed:dob363698007 ; snomed:263502005 snomed:90734009 . snomed:24078009_5 a rdfs:Class, snomed:24078009_5,snomed:dob363698007; snomed:116676008 snomed:110435003 ; snomed:246075003 snomed:6246005 ; snomed:3636980070 snomed:71836000 ; snomed:370135005 snomed:441862004 . snomed:24078009_6 a rdfs:Class, snomed:24078009_6,snomed:dob363698007 ; snomed:116676008 snomed:110435003 ; snomed:246075003 snomed:6246005 ; snomed:3636980070 snomed:72914001 ; snomed:370135005 snomed:441862004 . snomed:1003505005 a snomed:1003505005, rdfs:Class, snomed:dob; rdfs:label "Agenesis of rib (disorder)"^^xsd:string ; snomed:609096000 snomed:1003505005_1,snomed:1003505005_2 ; rdfs:subClassOf snomed:70974002 . snomed:1003505005_1 a snomed:1003505005_1, rdfs:Class, snomed:dob363698007 ; snomed:116676008 snomed:782173000 ; snomed:246454002 snomed:255399007 ; snomed:3636980070 snomed:302523002 ; snomed:370135005 snomed:308490002 . snomed:1003505005_2 a snomed:1003505005_2, rdfs:Class, snomed:dob363698007 ; snomed:116676008 snomed:782173000 ; snomed:246454002 snomed:255399007 ; snomed:3636980070 snomed:302523002 ; snomed:370135005 snomed:308490002 . To reiterate, I want “snomed:24078009” in the SPARQL query (?node a snomed:24078009) to be replaced by the current focusNode. Then create a union of all the results nodes present in ?this. and then apply the constraint sh:property [ sh:path snomed:363698007; sh:minCount 1; ] to this union, i.e., snomed:363698007 should be present in at least of the custom targets of a focusNode. Any implementation strategy/guidance would be highly appreciated. Many thanks, Rashmi Burse
Received on Monday, 14 March 2022 17:26:05 UTC