virtuoso-opensource
virtuoso-opensource copied to clipboard
Is there a way to get a list of triples (or subgraph) that can validate an ASK query
I'm looking to generate a subgraph which the query engine traverses through to validate an ASK query.
Example Query:
ASK WHERE {
:personA :isSonOf/(:isBrotherOf|:isSisterOf|:isCousinOf)+ :personZ .
}
Result = true
List of triples that form a solution:
:personA :isSonOf :personB .
:personB :isSisterOf :personC .
:personC :isCousinOf :personD .
:personD :isCousinOf :personZ .
Is there a way I can get that information? I'm not assuming it would be an easy task to keep listing the triples looked by Virtuoso. But if there's any chance I can make this work, I'll be more than happy to invest time implementing this on my fork.
Can someone please point me in the right direction?
On Tue, 27 Oct 2020 at 01:35, johnwick42n [email protected] wrote:
I'm looking to generate a subgraph which the query engine traverses through to validate an ASK query.
Example Query:
ASK WHERE { :personA :isSonOf/(:isBrotherOf|:isSisterOf|:isCousinOf)+ :personZ . }
Result = true
List of triples that form a solution: :personA :isSonOf :personB . :personB :isSisterOf :personC . :personC :isCousinOf :personD . :personD :isCousinOf :personZ .
Is there a way I can get that information? I'm not assuming it would be an easy task to keep listing the triples looked by Virtuoso. But if there's any chance I can make this work, I'll be more than happy to invest time implementing this on my fork.
Can someone please point me in the right direction?
Isn't that just a SELECT or CONSTRUCT?
~Tim
Tim Haynes Product Development Consultant OpenLink Software http://www.openlinksw.com/ http://twitter.com/openlink
Isn't that just a SELECT or CONSTRUCT?
What do you think the SELECT query would look like that gives me the following triples? :
:personA :isSonOf :personB .
:personB :isSisterOf :personC .
:personC :isCousinOf :personD .
:personD :isCousinOf :personZ .
Note: I do not know the number of nodes between :personA and :personZ (and the properties connecting them) exactly. All I have is :personA :isSonOf/(:isBrotherOf|:isSisterOf|:isCousinOf)+ :personZ .
.
On Tue, 27 Oct 2020 at 16:32, johnwick42n [email protected] wrote:
Isn't that just a SELECT or CONSTRUCT?
What do you think the SELECT query would look like that gives me the following information? :
List of triples that form a solution:
:personA :isSonOf :personB .
:personB :isSisterOf :personC .
:personC :isCousinOf :personD .
:personD :isCousinOf :personZ .
Note: I do not know the number of nodes between
:personA
and:personZ
(and the properties connecting them) exactly. All I have is:personA
:isSonOf/(:isBrotherOf|:isSisterOf|:isCousinOf)+ :personZ
..
You could try something like this - add an extra generic pattern and use the pattern above to refine it:
select distinct ?s ?p ?people { ?s ?p ?people . ?s :isSonOf/(:isBrotherOf|:isSisterOf|:isCousinOf)+ ?people . :personA :isSonOf/(:isBrotherOf|:isSisterOf|:isCousinOf)+ :personZ . :personA ?p :people . }}
Not complete, not tested, definitely not working, and tbh not something
I've had to do with property-paths in the mix before, but maybe as a
pointer: the idea is to get a list of all triple statements and then refine
it by those that are pinned on :personA
or :personZ
. The point of ?people
is to get a list of everyone who's on the end of such a property-path,
somewhere.
~Tim
Tim Haynes Product Development Consultant OpenLink Software http://www.openlinksw.com/ http://twitter.com/openlink
Not complete, not tested, definitely not working
Yes, I tried. thanks for the quick reply though. 😄
the idea is to get a list of all triple statements and then refine it by those that are pinned on :personA or :personZ. The point of ?people is to get a list of everyone who's on the end of such a property-path, somewhere.
Good though! Trying to look at all elements connected to :personA
and then looking at all the elements connected to those elements, eventually reaching :personZ
(meanwhile, making sure that the relationships justify the property path expression) is one solution. But, isn't this something that Virtuoso does anyway (internally) when it runs any of the following queries?
ASK WHERE {
:personA :isSonOf/(:isBrotherOf|:isSisterOf|:isCousinOf)+ :personZ .
}
SELECT ?someone WHERE {
:personA :isSonOf ?someone .
?someone (:isBrotherOf|:isSisterOf|:isCousinOf)+ :personZ .
}
If only there was a way to keep track of the triples it traverses through. 😞