Ahhh, this works like a charm! Thank you so much for the insight, David.

Carl

From: topbraid-users@googlegroups.com <topbraid-users@googlegroups.com> On 
Behalf Of David Price
Sent: Thursday, June 22, 2023 11:47 AM
To: topbraid-users@googlegroups.com
Subject: Re: [topbraid-users] SHACL NodeShape help


*** External email: use caution ***
This seems to work. If I make a data graph then instances of Person only show a 
“Car” instances of Vehicle when setting ownsVehicle.

@prefix ex: <http://example.org/ontologies/davd#> .
@prefix graphql: <http://datashapes.org/graphql#> .
@prefix metadata: <http://topbraid.org/metadata#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix teamwork: <http://topbraid.org/teamwork#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

ex:Car
  a sh:NodeShape ;
  rdfs:label "Car" ;
  sh:property ex:Car-kind ;
  sh:targetObjectsOf ex:vehicleKind ;
.
ex:Car-kind
  a sh:PropertyShape ;
  sh:path ex:vehicleKind ;
  sh:datatype xsd:string ;
  sh:in (
      "Car"
    ) ;
.
ex:Person
  a owl:Class ;
  a sh:NodeShape ;
  rdfs:label "Person" ;
  rdfs:subClassOf owl:Thing ;
  sh:property ex:Person-name ;
  sh:property ex:Person-ownsVehicle ;
.
ex:Person-name
  a sh:PropertyShape ;
  sh:path ex:name ;
  sh:datatype xsd:string ;
  sh:name "name" ;
.
ex:Person-ownsVehicle
  a sh:PropertyShape ;
  sh:path ex:ownsVehicle ;
  sh:class ex:Vehicle ;
  sh:name "owns vehicle" ;
  sh:node ex:Car ;
.
ex:Vehicle
  a owl:Class ;
  a sh:NodeShape ;
  rdfs:label "Vehicle" ;
  rdfs:subClassOf owl:Thing ;
  sh:property ex:Vehicle-tag ;
  sh:property ex:Vehicle-vehicleKind ;
.
ex:Vehicle-tag
  a sh:PropertyShape ;
  sh:path ex:tag ;
  sh:datatype xsd:string ;
  sh:maxCount 1 ;
  sh:name "tag" ;
.
ex:Vehicle-vehicleKind
  a sh:PropertyShape ;
  sh:path ex:vehicleKind ;
  sh:datatype xsd:string ;
  sh:in (
      "Car"
      "Train"
    ) ;
  sh:maxCount 1 ;
  sh:name "vehicle kind" ;
.

Cheers,
David


On 22 Jun 2023, at 18:22, cbur...@healthwise.org<mailto:cbur...@healthwise.org> 
<cburn...@healthwise.org<mailto:cburn...@healthwise.org>> wrote:

Let's say I have a sh:NodeShape and an accompanying sh:PropertyShape -- call it 
ex:NodeShape-myProperty. I want to specify that all targets of this property 
shape must conform to particular pattern -- namely, they must have a particular 
value for a particular property; i.e., the triple

ex:MyResource ex:requiredProperty ex:RequiredValue

must exist for each object of ex:myProperty. Ideally, I'd want EDG to only 
display resources that met this pattern as possible objects to be selected in 
the Editor for ex:myProperty -- not just use the pattern for validation when 
saving the data.

How do I represent this? Can I do this using just sh:property, or do I need to 
create another sh:NodeShape to represent the targets of 
ex:NodeShape-myProperty? What would that look like?

It's a basic enough pattern that I was sure some examples would exist in the TQ 
SHACL documentation, but I can't find any. Can anyone help? Thanks.

--
The topics of this mailing list include TopBraid EDG and related technologies 
such as SHACL.
To post to this group, send email to 
topbraid-users@googlegroups.com<mailto:topbraid-users@googlegroups.com>
---
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
topbraid-users+unsubscr...@googlegroups.com<mailto:topbraid-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/81724a8d-7694-44a2-84eb-1e40f7f7aa27n%40googlegroups.com<https://groups.google.com/d/msgid/topbraid-users/81724a8d-7694-44a2-84eb-1e40f7f7aa27n%40googlegroups.com?utm_medium=email&utm_source=footer>.

UK +44 (0) 7788 561308
US +1 (336) 283-0808

--
The topics of this mailing list include TopBraid EDG and related technologies 
such as SHACL.
To post to this group, send email to 
topbraid-users@googlegroups.com<mailto:topbraid-users@googlegroups.com>
---
You received this message because you are subscribed to a topic in the Google 
Groups "TopBraid Suite Users" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/topbraid-users/FTFYmtYbkCI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
topbraid-users+unsubscr...@googlegroups.com<mailto:topbraid-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/40E9DD49-06DE-47C5-940D-9A503360FDEE%40topquadrant.com<https://groups.google.com/d/msgid/topbraid-users/40E9DD49-06DE-47C5-940D-9A503360FDEE%40topquadrant.com?utm_medium=email&utm_source=footer>.

-- 
The topics of this mailing list include TopBraid EDG and related technologies 
such as SHACL.
To post to this group, send email to topbraid-users@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/SJ2PR19MB7388DAB0CF024CF0BF3F4480B722A%40SJ2PR19MB7388.namprd19.prod.outlook.com.

Reply via email to