Re: [topbraid-users] SPARQL Query for distance between nodes

2024-03-07 Thread Holger Knublauch
If SPARQL could express this then the extra functions wouldn't be needed. So I guess this goes beyond what SPARQL can do. I guess Matt just sent something along those lines. Holger > On 7 Mar 2024, at 4:55 pm, steveray...@gmail.com > wrote: > > Thanks. Would you also agree that this

Re: [topbraid-users] SPARQL Query for distance between nodes

2024-03-07 Thread Matt Goldberg
On a semi-related note, tasks like this are why I suggested a pathfinding extension to the SPARQL specification such that these types of operations would be supported across implementations https://github.com/w3c/sparql-dev/issues/191 On Thursday, March 7, 2024 at 11:52:52 AM UTC-5 Holger

Re: [topbraid-users] SPARQL Query for distance between nodes

2024-03-07 Thread steveray...@gmail.com
Thanks. Would you also agree that this approach is better than trying to do something in native SPARQL? I have always seen SPARQL as better suited to declarative, set-based problems rather than navigational ones. On Thursday, March 7, 2024 at 11:52:52 AM UTC-5 Holger Knublauch wrote: > Hi

Re: [topbraid-users] SPARQL Query for distance between nodes

2024-03-07 Thread Holger Knublauch
Hi Steve, this is implemented in Java, but yes there is no rocket science and it could be reimplemented in other languages. Basically do a breadth-first traversal. Holger > On 7 Mar 2024, at 4:33 pm, steveray...@gmail.com > wrote: > > Holger, this thread was very interesting for me to

Re: [topbraid-users] SPARQL Query for distance between nodes

2024-03-07 Thread steveray...@gmail.com
Holger, this thread was very interesting for me to read, because it addresses a navigational problem we're looking at. However, some of my colleagues do not use the TopQuadrant tools, so they don't have spif:shortestObjectsPath available. Am I correct that this was coded in another language?

Re: [topbraid-users] SPARQL Query for distance between nodes

2024-02-21 Thread Marie Valadez
Thank you so much! Appreciate all your help. On Tuesday, February 20, 2024 at 12:29:47 PM UTC-7 Holger Knublauch wrote: > > On 20 Feb 2024, at 6:11 pm, Marie Valadez wrote: > > Thank Holger. > > Is there a way to return a count with this that shows the distance? > > > Sure. The function

Re: [topbraid-users] SPARQL Query for distance between nodes

2024-02-20 Thread Holger Knublauch
> On 20 Feb 2024, at 6:11 pm, Marie Valadez wrote: > > Thank Holger. > > Is there a way to return a count with this that shows the distance? Sure. The function returns a ?path string with one space between path segments. You can use BIND (REPLACE(?path, "[^ ]", "") AS ?spaces) .

Re: [topbraid-users] SPARQL Query for distance between nodes

2024-02-20 Thread Marie Valadez
Thank Holger. Is there a way to return a count with this that shows the distance? On Monday, February 19, 2024 at 12:37:20 AM UTC-7 Holger Knublauch wrote: > Yes, g:Europe is the end node and is optional. If no end node is > specified, it will stop at whenever a node doesn't have further

Re: [topbraid-users] SPARQL Query for distance between nodes

2024-02-18 Thread Holger Knublauch
Yes, g:Europe is the end node and is optional. If no end node is specified, it will stop at whenever a node doesn't have further values of skos:broader. You can use spif:shortestSubjectsPath for the inverse direction. To find the paths to each child, loop over the children: SELECT * WHERE {

Re: [topbraid-users] SPARQL Query for distance between nodes

2024-02-17 Thread Marie Valadez
The way skos:broader is being used in our case is a tree like structure with some having multiple parents that can be broader but will point back to the same main broad concept which branches out to its children, grandchildren, etc. I need the shortest path from whichever instance is selected to

Re: [topbraid-users] SPARQL Query for distance between nodes

2024-02-17 Thread Holger Knublauch
Hi Marie, we do have some built-in functions including spif:shortestObjectsPath and swa:shortestPathsBetweenNodes that may help. To clarify your requirements, is it true that one of the nodes is always an (indirect) parent of the other node, or does the algorithm also need to walk in one

[topbraid-users] SPARQL Query for distance between nodes

2024-02-16 Thread Marie Valadez
I have searched and tested out multiple ways to get the distance between two nodes. I want a query that will show the child concepts and how far away they are from the current concept so that I can create a table on a form showcasing this. The following query works if a ?sub concept does not