On Sep 11, 2020, at 6:02 PM, cbur...@healthwise.org <cbur...@healthwise.org> wrote:These questions are more about SHACL than about EDG per se, but I think you experts will be able to help me.1. sh:disjoint: I have used sh:disjoint to declare that the sh:path of a property shape is disjoint with another another property, like this:ex:Concept-propertya sh:PropertyShape ;sh:path ex:property ;sh:disjoint ex:property2 .Testing this out in EDG 6.4.1 yields no constraint violations when I assign values to a certain instance of ex:Concept for both ex:property and ex:property2. Have I set this up incorrectly, or do I need to do something else to make EDG raise warnings in this situation?
2. Inferring data: Suppose ex:property and ex:property2 are disjoint for a given shape, as specified above. If an instance of ex:Concept has exactly one value for either ex:property or ex:property2, I would like to infer that this is the value of ex:property3. How could this be modeled?
2. A different property pair constraint: This case is nearly the opposite of the above. Suppose I wish to specify that any value of ex:property4 (which has sh:maxCount 1) must be one of the values of ex:property5 (which has no sh:maxCount). How would I express that? (I don't see a way to do it using sh:equals.)
Thanks for any insight you can provide.
--
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-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/edfc34b2-9f78-42f3-a186-44bde1dd23cdn%40googlegroups.com.
On Sep 11, 2020, at 6:02 PM, cbur...@healthwise.org <cbur...@healthwise.org> wrote:
These questions are more about SHACL than about EDG per se, but I think you experts will be able to help me.1. sh:disjoint: I have used sh:disjoint to declare that the sh:path of a property shape is disjoint with another another property, like this:
ex:Concept-propertya sh:PropertyShape ;sh:path ex:property ;sh:disjoint ex:property2 .
Testing this out in EDG 6.4.1 yields no constraint violations when I assign values to a certain instance of ex:Concept for both ex:property and ex:property2. Have I set this up incorrectly, or do I need to do something else to make EDG raise warnings in this situation?Disjoint means that a given resource cannot have the same value for ex; property as for ex:property2. E.g., a pref label for resource X can’t be the same as alLabel for resource X. Is this what you meant?
Or do you mean something else i.e., it either have a value for ex:property or a value for ex:property2 e.g., either foaf:givenName or foaf:firstName, but not both. If so, then use xone: https://www.w3.org/TR/shacl/#XoneConstraintComponent
2. Inferring data: Suppose ex:property and ex:property2 are disjoint for a given shape, as specified above. If an instance of ex:Concept has exactly one value for either ex:property or ex:property2, I would like to infer that this is the value of ex:property3. How could this be modeled?The exact expression depends on your answer to the first question.
2. A different property pair constraint: This case is nearly the opposite of the above. Suppose I wish to specify that any value of ex:property4 (which has sh:maxCount 1) must be one of the values of ex:property5 (which has no sh:maxCount). How would I express that? (I don't see a way to do it using sh:equals.)SPARQL-based constraint
Yes or dash:subSetOf already implements this SPARQL constraint:
http://datashapes.org/constraints.html#SubSetOfConstraintComponent
Holger
--
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-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/5d0403df-9dec-4828-9d84-edc81c78eb6cn%40googlegroups.com.
I guess this makes sense. I added a sh:minCount of 1.
Now I get no violation when concept_schema:preferred_specialty has a value. But I still get a violation when only concept_schema:preferred_specialty_inferred has a value. I imagine this is because it can only have inferred values and not explicit ones, or perhaps because the sh:path of the property shape is a magic property. This is what the property shape looks like:
concept_schema:HwcvConcept-has_inferred_specialty
a sh:PropertyShape ;
sh:path <http://metadata.healthwise.org/app/magic-props#has_inferred_specialty> ;
rdfs:label "managing specialties (inferred)" ;
sh:class concept_schema:SpecialtyConcept ;
sh:group concept_schema:Ontological_Relationships ;
sh:name "managing specialties (inferred)" ;
sh:nodeKind sh:IRI ;
sh:order 8.1 ;
sh:values [
<http://metadata.healthwise.org/app/magic-props#has_inferred_specialty> (
sh:this
) ;
] ;
.
Is there anything I can do to tell the SHACL engine that inferred values for has_inferred_specialty should meet my sh:xone constraint?
As an aside: the phrasing of the constraint violation message for sh:xone could be a lot better. My taxonomy’s users don’t know or care what a “sh:xone enumeration” means. What would be helpful to them is a message like this: “Either [concept 1] or [concept 2] should have a value, but not both.”
From: topbrai...@googlegroups.com <topbrai...@googlegroups.com>
On Behalf Of Irene Polikoff
Sent: Tuesday, September 15, 2020 11:35 AM
To: topbrai...@googlegroups.com
Subject: Re: [topbraid-users] SHACL help
*** External email: use caution ***
--
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/04w-ddzQ81I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
topbraid-user...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/1F2112E2-0562-45D2-9DA2-73A8DCAAE555%40topquadrant.com.
2. A different property pair constraint: This case is nearly the opposite of the above. Suppose I wish to specify that any value of ex:property4 (which has sh:maxCount 1) must be one of the values of ex:property5 (which has no sh:maxCount). How would I express that? (I don't see a way to do it using sh:equals.)
SPARQL-based constraint
Yes or dash:subSetOf already implements this SPARQL constraint:
http://datashapes.org/constraints.html#SubSetOfConstraintComponent
Holger
One option is to surround it with an outer sh:or, e.g.
ex:TestShape
a sh:NodeShape ;
sh:or (
[
sh:property [
sh:path ex:property1 ;
dash:subSetOf ex:other ;
]
]
[
sh:property [
sh:path ex:property2 ;
dash:subSetOf ex:other ;
]
]
) .
Depending on your desired semantics, you may also use a | path expression:
ex:TestShape
a sh:NodeShape ;
sh:property [
sh:path [
sh:alternativePath ( ex:property1 ex:property2 )
] ;
dash:subSetOf ex:other ;
] .
The meaning of the latter is that the combined values of prop1
and prop2 must be a subset, so this may not be the exact semantics
that you need.
Holger
I guess this makes sense. I added a sh:minCount of 1.
Now I get no violation when concept_schema:preferred_specialty has a value. But I still get a violation when only concept_schema:preferred_specialty_inferred has a value. I imagine this is because it can only have inferred values and not explicit ones, or perhaps because the sh:path of the property shape is a magic property. This is what the property shape looks like:
concept_schema:HwcvConcept-has_inferred_specialty
a sh:PropertyShape ;
sh:path <http://metadata.healthwise.org/app/magic-props#has_inferred_specialty> ;
rdfs:label "managing specialties (inferred)" ;
sh:class concept_schema:SpecialtyConcept ;
sh:group concept_schema:Ontological_Relationships ;
sh:name "managing specialties (inferred)" ;
sh:nodeKind sh:IRI ;
sh:order 8.1 ;
sh:values [
<http://metadata.healthwise.org/app/magic-props#has_inferred_specialty> (
sh:this
) ;
] ;
.
Is there anything I can do to tell the SHACL engine that inferred values for has_inferred_specialty should meet my sh:xone constraint?
Up to 6.4, SHACL validation does not "see" the inferred values unless you have asserted them beforehand.
From 7.0 onwards, you can activate these inferences to be computed beforehand, by adding a triple
?ontology sh:entailment sh:Rules .
The latter should already work with the latest SHACL API snapshot.
As an aside: the phrasing of the constraint violation message for sh:xone could be a lot better. My taxonomy’s users don’t know or care what a “sh:xone enumeration” means. What would be helpful to them is a message like this: “Either [concept 1] or [concept 2] should have a value, but not both.”
I agree the current message template
"Value has " + count + " shapes out of " + shapes.size() + " in the sh:xone enumeration"
is a bit geeky. It would be doable to change it to "Value must conform to exactly one of the following shapes, but conforms to N: ..., ..., ...]"
It would be much harder to construct a message as you suggest because that would require deeper understanding of the mentioned shapes.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/MWHPR19MB159878A315C48958FDC9DDD5B7200%40MWHPR19MB1598.namprd19.prod.outlook.com.