On 11/25/2020 12:32 PM, Steve Ray wrote:
Wow, fast!
I was just trying exactly that. I also dropped the prefixes since I
wasn't using any. So now I have:
ssh:Class_1
rdf:type owl:Class ;
rdf:type sh:NodeShape ;
rdfs:subClassOf owl:Thing ;
sh:property [
sh:path ssh:Property_1 ;
sh:values [
sh:select """SELECT ?result
WHERE {
BIND (\"Hello\" AS ?result) .
}""" ;
] ;
] ;
.
So far so good.
But executing this query:
*SELECT**
*WHERE*{
?subject a ssh:Class_1 .
?subject ssh:Property_1 ?object .
}
...is coming up empty.
This is because SPARQL only queries the asserted graph. To query the
inferred values, either use GraphQL, Active Data Shapes or use this
magic property:
PREFIX teamwork: <http://topbraid.org/teamwork#>
SELECT *
WHERE {
...
(?subject ssh:Property_1 <urn:x-evn-master:geo>) teamwork:values
?object .
}
This takes the master graph that is holding the data in EDG (here: the
Geography ontology). This is the fastest variation for performance, but
this one here is more general:
(?subject ssh:Property_1) tosh:values ?object .
This design has some implications, e.g. you normally cannot query
inferred values in the inverse direction, e.g. if ?object is given. They
are just computed on the fly, for the duration of the query. This means
that the system doesn't need to keep track of inferences or invalidate
them if the data changes - it's always up to date.
Holger
(Once I get one example working, I'm off to the races!)
Steve
On Tue, Nov 24, 2020 at 6:25 PM Holger Knublauch
<[email protected] <mailto:[email protected]>> wrote:
On 11/25/2020 12:18 PM, Steve Ray wrote:
Sorry to keep using up bandwidth here.
No problem. Admittedly, the official spec at
https://w3c.github.io/shacl/shacl-af/#select
<https://w3c.github.io/shacl/shacl-af/#select> is not exactly full
of examples. A failure of the editor :)
I have pored over all the documentation I can find on the proper
use of sh:values with SPARQL, and clearly I'm not getting
something. Here is my trivial toy example that is supposed to
just infer a hard-coded value of "Hello" for a property. Can you
see what I'm doing wrong?
TBC keeps saying: Property ssh:Property_1: values=(SHACL node
expression of unknown type: java.lang.IllegalArgumentException:
Malformed SHACL node expression)
I'm also attaching the full file in case you want to just load it.
Just drop the sh:sparql node and instead do something like
sh:values [
sh:select ...
sh:prefixes ...
]
HTH
Holger
ssh:Class_1
a owl:Class ;
a sh:NodeShape ;
rdfs:subClassOf owl:Thing ;
sh:property [
sh:path ssh:Property_1 ;
sh:values [
sh:sparql [
sh:prefixes <http://example.org/sparqlshape
<http://example.org/sparqlshape>> ;
sh:select """SELECT ?result
WHERE {
BIND (\"Hello\"AS ?result) .
}""" ;
] ;
] ;
] ;
.
ssh:Instance_1
a ssh:Class_1 ;
.
ssh:Property_1
a rdf:Property ;
.
Steve
On Tue, Nov 24, 2020 at 2:57 PM Holger Knublauch
<[email protected] <mailto:[email protected]>> wrote:
On 11/25/2020 8:48 AM, Steve Ray wrote:
I agree with you. Is there no way to have "variable"
predicates in native SHACL? Or is my only option here to use
the embedded SPARQL?
Exactly. SHACL node expressions do not have a notion of
variables. It is intentionally limited to be easier, but then
doesn't offer all features that SPARQL does. There is nothing
wrong with using SPARQL node expressions as a fallback.
Holger
Steve
On Tue, Nov 24, 2020 at 12:51 PM Irene Polikoff
<[email protected] <mailto:[email protected]>> wrote:
There is no path in your example that could get from
?this to ?prop. A path specifies predicates. You do not
have predicates to specify - you are finding out your
predicates in the first WHERE statement. This is why you
need to have 2 statements in the WHERE clause and can’t
boil them down to a path expression in a single statement.
On Nov 24, 2020, at 12:39 PM, Steve Ray
<[email protected] <mailto:[email protected]>> wrote:
I'm trying to get comfortable with using SHACL code and
wean myself from embedded SPARQL. However, I'm having
some trouble mapping certain common SPARQL patterns
into the SHACL counterpart. Specifically, here's an
example. I'm trying to find all the values of any
property that is a subPropertyOf a parent property
(c223:hasProperty).
The SPARQL should (I think) be something like this:
c223:PropertiesShape
rdf:type sh:PropertyShape ;
sh:path c223:hasProperty ;
sh:name "PropertiesShape" ;
sh:values [
sh:sparql [
sh:prefixes
<http://www.w3.org/2000/01/rdf-schema
<http://www.w3.org/2000/01/rdf-schema>> ;
sh:select """SELECT DISTINCT ?prop
WHERE {
?property rdfs:subPropertyOf* c223:hasProperty .
$this ?property ?prop .
}""" ;
] ;
] ;
.
I know the following is wrong, but not sure what sh:
calls I should be using:
c223:PropertiesShape
rdf:type sh:PropertyShape ;
sh:path c223:hasProperty ;
sh:name "PropertiesShape" ;
sh:values [
sh:distinct [
sh:nodes [
sh:path (
[
sh:zeroOrMorePath rdfs:subPropertyOf ;
]
c223:hasProperty
) ;
] ;
] ;
] ;
.
This gives me a "malformed SHACL expression", so there
are definitely problems.
My real question is, how does one duplicate this
pattern in SHACL?:
WHERE {
?property rdfs:subPropertyOf* <parentProperty> .
$this ?property ?result .
}
Steve
--
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
[email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/CAGUep87nmSVo5eziHPh6ExbPD1%3DD%3DWrfTNOwNtK0PBww21%3DpgA%40mail.gmail.com
<https://groups.google.com/d/msgid/topbraid-users/CAGUep87nmSVo5eziHPh6ExbPD1%3DD%3DWrfTNOwNtK0PBww21%3DpgA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
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
[email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/11EA64E3-07D1-4DAF-A609-21C84A739254%40topquadrant.com
<https://groups.google.com/d/msgid/topbraid-users/11EA64E3-07D1-4DAF-A609-21C84A739254%40topquadrant.com?utm_medium=email&utm_source=footer>.
--
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
[email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/CAGUep87Hq%3DPv7rCT0f3aQPU%2BzYo27dA1eodYyGe9ZOoh4D9opA%40mail.gmail.com
<https://groups.google.com/d/msgid/topbraid-users/CAGUep87Hq%3DPv7rCT0f3aQPU%2BzYo27dA1eodYyGe9ZOoh4D9opA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
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
[email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/41fa8018-8314-3e9b-b854-7fbc1e70f87a%40topquadrant.com
<https://groups.google.com/d/msgid/topbraid-users/41fa8018-8314-3e9b-b854-7fbc1e70f87a%40topquadrant.com?utm_medium=email&utm_source=footer>.
--
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 [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/CAGUep87xZen2zPqno3u%2BVjXKHBCHcx-b8VJeX4cHTnrzP9eE1g%40mail.gmail.com
<https://groups.google.com/d/msgid/topbraid-users/CAGUep87xZen2zPqno3u%2BVjXKHBCHcx-b8VJeX4cHTnrzP9eE1g%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
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 [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/6b37a258-8507-22ce-e8e4-384b893c2dd9%40topquadrant.com
<https://groups.google.com/d/msgid/topbraid-users/6b37a258-8507-22ce-e8e4-384b893c2dd9%40topquadrant.com?utm_medium=email&utm_source=footer>.
--
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 [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/CAGUep86jmegagE%3D9W84epw_%3DofMCb6ktcCZa3cVJS7Sq0M27eQ%40mail.gmail.com
<https://groups.google.com/d/msgid/topbraid-users/CAGUep86jmegagE%3D9W84epw_%3DofMCb6ktcCZa3cVJS7Sq0M27eQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/21a18751-29ba-e10c-4c8e-103ff8aa94df%40topquadrant.com.