abargnesi
(Tony Bargnesi)
January 25, 2017, 12:42pm
1
Hello,
As an example take the SKOS data model for creating thesauri. It defines the exactMatch predicate to be transitive.
Given triples:
<A> <skos:exactMatch> <B>
<B> <skos:exactMatch> <C>
<B> <skos:exactMatch> <D>
One could query for all nodes connected to <A>
through one or more transitive <skos:exactMatch>
predicates. This would yield:
<A> <skos:exactMatch> <B>
<A> <skos:exactMatch> <C>
<A> <skos:exactMatch> <D>
In SPARQL 1.1 this can be accomplished through property paths.
For example:
prefix skos: <http://www.w3.org/2004/02/skos/core#>
CONSTRUCT {
<a> skos:exactMatch ?o .
}
WHERE {
<a> skos:exactMatch+ ?o .
}
This would build all triples at least one <skos:exactMatch>
away from <a>
.
Can this be accomplished in any way with dgraph at the moment? Will work on shortest path enable this type of query?
Thanks,
Tony
mrjn
(Manish R Jain)
January 25, 2017, 10:14pm
2
Hi @abargnesi ,
You can query this like so:
{
me(id: a) {
skos:exactMatch {
skos:exactMatch { .. and so on .. }
}
}
}
This way you can find all connections to <a>
which are connected via the exactMatch predicate, but multiple levels away from <a>
.
Dgraph is really fast for such traversals. So, we don’t have any feature to do “path shortening.”
abargnesi
(Tony Bargnesi)
January 26, 2017, 12:38am
3
Thanks @mrjn .
In my case I do not know a priori how many edges away to search, so a finite number of steps wouldn’t work for my use case (i.e. the exact number of predicates connecting equivalent nodes).
Providing skos:exactMatch+
would find the complete transitive closure without needing to specify some arbitrary number.
system
(system)
Closed
November 28, 2017, 1:00am
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.