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 to find Instances with the same values for property

2024-02-22 Thread Holger Knublauch
To get the COUNT of a path expression, spl:objectCount will not help. Normally, counting can be done via a nested SELECT query with a COUNT in SPARQL. However, nested queries by default do not "see" variables from the outside, making them rather inefficient. There is a new SPARQL keyword,

Re: [topbraid-users] SPARQL Query to find Instances with the same values for property

2024-02-22 Thread Marie Valadez
Thank you Holger. That's a good idea to use count to narrow down the ones that are the same. Do you happen to have more documentation on the spl:ObjectCount? I am trying to find a way to utilize this with inherited ones as well through skos:broader*/ex:category where in some cases they might

Re: [topbraid-users] SPARQL Query to find Instances with the same values for property

2024-02-22 Thread Holger Knublauch
Ok, to express that, I believe you need to 1) Make sure that the number of property values is the same for both concepts, and that 2) The second concept does NOT have any values that the first concept does not also have. This can be expressed using FILTER NOT EXISTS { … }. To count values

Re: [topbraid-users] SPARQL Query to find Instances with the same values for property

2024-02-22 Thread Marie Valadez
Hi Holger, Thanks for getting back to me so quickly. I only want to return Concept B since it has exactly the same blank nodes as Concept A. I don't want to return Concept C and Concept D since they either have 1 less or 1 more than Concept A. On Thursday, February 22, 2024 at 2:55:09 AM

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

[topbraid-users] SPARQL Query to find Instances with the same values for property

2024-02-21 Thread Marie Valadez
I am in EDG trying to find instances where another Concept has the exact same values for the property (no more or less). The values can be inherited through skos:broader or directly stated on the concept itself. The property connects to a blank node which contains 2 additional properties and

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

Re: [topbraid-users] sparql query to get all objects

2024-01-30 Thread Kasia Kryczka
It worked, but I can see it in the source code : j.2:editor ; j.2:viewer ; but not in the Users Panel but when I add uri.add(edg + 'dataSteward', tbs.userURI('Test User')); this one I can see in the users Panel. Why is that ? Br, Kasia On Tuesday, January 30, 2024 at 2:44:29 PM UTC+1

Re: [topbraid-users] sparql query to get all objects

2024-01-30 Thread Kasia Kryczka
Hi Holger, as for this ?subject and ?class 2 it was my mistake. The query is correct with ?subject. I'll check the hours and create a ticket :) I have one more question. How to add teamwork: editor and viewer. let id = tbs.createAssetCollection({ typeLabel: "Glossary", name: "Test

Re: [topbraid-users] sparql query to get all objects

2024-01-30 Thread Holger Knublauch
I don't see why it would ever write to some imported graph - the graph.transaction clearly targets just the given graphURI. It does however also collect unused classes from imported graphs, because the select query walks across those. BTW note that with SELECT ?subject

Re: [topbraid-users] sparql query to get all objects

2024-01-30 Thread Kasia Kryczka
Sure, let graphURI = 'urn:x-evn-master:test'; graph.withDataGraph(graphURI, () => { let usedURIs = graph.withDataGraph(graphURI + '.tch', () => { return graph.select(` SELECT DISTINCT ?uri WHERE { ?t ?o ?uri . FILTER isIRI(?uri)

Re: [topbraid-users] sparql query to get all objects

2024-01-30 Thread Holger Knublauch
Could you paste the code that you have right now so that I can see the full context? Thanks Holger > On 30 Jan 2024, at 11:58 am, Kasia Kryczka wrote: > > Hi Holger, > > > Unfortunately, the solution does not give the expected results. > > It appears that when we add the history of

Re: [topbraid-users] sparql query to get all objects

2024-01-30 Thread Kasia Kryczka
Hi Holger, Unfortunately, the solution does not give the expected results. It appears that when we add the history of changes to all the includes, the history is saved in the included ontology and not in the collection we are in. Could you please advise whether this script can be adapted

Re: [topbraid-users] sparql query to get all objects

2024-01-10 Thread Kasia Kryczka
Hi Holger, This is great :) Thank you, Br, Kasia On Monday, January 8, 2024 at 2:08:02 PM UTC+1 Holger Knublauch wrote: > Ok in that case, use something like > > let triples = graph.withDataGraph(dataset.withImports(graphURI), () => > graph.triples(orphan)); > > (You will likely want to

Re: [topbraid-users] sparql query to get all objects

2024-01-08 Thread Holger Knublauch
Ok in that case, use something like let triples = graph.withDataGraph(dataset.withImports(graphURI), () => graph.triples(orphan)); (You will likely want to filter out owl:Thing and all kinds of other classes that will be listed.) Holger > On 8 Jan 2024, at 2:03 pm, Kasia Kryczka wrote: >

Re: [topbraid-users] sparql query to get all objects

2024-01-08 Thread Kasia Kryczka
Hi Holger, I got a request to create a dummy change history comment for all owl:Class both defined locally and those which are included from all imports. These owl:Thing and owl:Nothing do not need to have a dummy comment but I have much more included classes from imports. Br, Kasia On

Re: [topbraid-users] sparql query to get all objects

2024-01-08 Thread Holger Knublauch
Ok thanks, I better see what you're trying to do now. My previous "hint" was not helpful. I ran the script in my test setup and think there is a mismatch between the use of imported graphs: When you collect the orphans it will walk into the subgraphs, which in my case found imported classes

Re: [topbraid-users] sparql query to get all objects

2024-01-08 Thread Kasia Kryczka
Hi Holger, Unfortunately, it doesn't work. I get the comment but nothing gets added. The record is empty. When i look at the console I see correct "orphans" and I changed so the usedURIs should be a match when filtering but the result is the same. let graphURI = 'urn:x-evn-master:test';

Re: [topbraid-users] sparql query to get all objects

2024-01-05 Thread Holger Knublauch
> On 5 Jan 2024, at 3:51 pm, Kasia Kryczka wrote: > > Hi Holger, > > > I used a different thing as I need to add a change history to all these > objects: I used the following : > > > let graphURI = 'urn:x-evn-master:test'; > graph.withDataGraph(graphURI, () => { > let usedURIs =

Re: [topbraid-users] sparql query to get all objects

2024-01-05 Thread Kasia Kryczka
Hi Holger, I used a different thing as I need to add a change history to all these objects: I used the following : let graphURI = 'urn:x-evn-master:test'; graph.withDataGraph(graphURI, () => { let usedURIs = graph.withDataGraph(graphURI + '.tch', () => { return graph.select(`

Re: [topbraid-users] sparql query to get all objects

2024-01-05 Thread Holger Knublauch
To get instances of a class and its subclasses, use this trick from further below, SELECT ?instance WHERE { ?instance rdf:type/rdfs:subClassOf* ex:SomeClass . } This can also be rewritten as SELECT ?instance WHERE { ?type rdfs:subClassOf* ex:SomeClass .

Re: [topbraid-users] sparql query to get all objects

2024-01-05 Thread Kasia Kryczka
Hi Holger, ok, but this still doesn't give me everything I need. I get like a part of all the results from imports. Unfortynately I cannot post pictures. My ontology has owl:imports ; owl:imports ; owl:imports ;

Re: [topbraid-users] sparql query to get all objects

2024-01-05 Thread Holger Knublauch
In ADS you can write let instances = graph.withDataGraph(dataset.withImports('urn:x-evn-master:geo'), () => graph.select(` SELECT ?instance WHERE { ?instance a skos:Concept . } `)) instances.bindings Holger > On 5 Jan 2024, at 8:46 am, Kasia Kryczka

Re: [topbraid-users] sparql query to get all objects

2024-01-04 Thread Kasia Kryczka
Hi Holger, thank you for quick reply. The thing is I don't want to use the include imports checkbox. I want to have a query which I can later use in ADS. Br, Kasia On Thursday, January 4, 2024 at 4:02:09 PM UTC+1 Holger Knublauch wrote: > Are you using the SPARQL endpoint? Then activate

Re: [topbraid-users] sparql query to get all objects

2024-01-04 Thread Holger Knublauch
Are you using the SPARQL endpoint? Then activate the Include Imports checkbox. >From the SPARQL query panel, it would be something like SELECT ?instance WHERE { ?instance rdf:type/rdfs:subClassOf* ex:SomeClass . } which would also get the instances of the subclasses of the given class.

[topbraid-users] sparql query to get all objects

2024-01-04 Thread Kasia Kryczka
Hi, This might be a simple question but I got stuck. I want to get all object from an ontology which are of a owl:Class but which are also defined in all the includes of that particular ontology. Any help would be great. Thanks, Kasia -- The topics of this mailing list include TopBraid

Re: [topbraid-users] SPARQL query to identify Graph URI (ignore Included graphs)

2023-06-23 Thread Dan Segal
Thank you, Holger and David for those suggestions. Both very helpful...much appreciated! Regards, Dan On Thursday, June 22, 2023 at 1:42:11 PM UTC-4 Holger Knublauch wrote: > Yes that's a more general solution that should also work well, except in > cases of cyclic owl:imports where some

Re: [topbraid-users] SPARQL query to identify Graph URI (ignore Included graphs)

2023-06-23 Thread Dan Segal
Thank you, Holder and David for those suggestions. Both very helpful...much appreciated! Regards, Dan On Thursday, June 22, 2023 at 1:42:11 PM UTC-4 Holger Knublauch wrote: > Yes that's a more general solution that should also work well, except in > cases of cyclic owl:imports where some

Re: [topbraid-users] SPARQL query to identify Graph URI (ignore Included graphs)

2023-06-22 Thread Holger Knublauch
Yes that's a more general solution that should also work well, except in cases of cyclic owl:imports where some other asset collection also happens to owl:import the main one. Holger > On 22 Jun 2023, at 5:56 pm, David Price wrote: > > Normal SPARQL can do this too in the general case: > >

Re: [topbraid-users] SPARQL query to identify Graph URI (ignore Included graphs)

2023-06-22 Thread David Price
Normal SPARQL can do this too in the general case: FILTER NOT EXISTS { ?graphx owl:imports ?graph . } Cheers, David > On 22 Jun 2023, at 17:24, Holger Knublauch wrote: > > Hi Dan, > > you can use this fragment to get the "main" active graph > > PREFIX teamwork:

Re: [topbraid-users] SPARQL query to identify Graph URI (ignore Included graphs)

2023-06-22 Thread Holger Knublauch
Hi Dan, you can use this fragment to get the "main" active graph PREFIX teamwork: SELECT * WHERE { BIND (teamwork:currentMasterGraph() AS ?graph) } from the SPARQL endpoint and the SPARQL panel, assuming the currently active query graph is an asset

[topbraid-users] SPARQL query to identify Graph URI (ignore Included graphs)

2023-06-22 Thread Dan Segal
Hello, I need to identify a Graph URI, or alternatively the metadata:idenfitier value, where the query returns only for the local graph, ignoring any included graphs. For example: SELECT ?graph ?id WHERE { ?graph metadata:identifier ?id } returns: *graph* *id*

Re: [topbraid-users] sparql query to show current workspace

2023-04-24 Thread Kasia Kryczka
Thank you :) On Monday, April 24, 2023 at 2:50:09 PM UTC+2 Holger Knublauch wrote: > Ok thanks for the clarification. I don't see any alternative to something > like > > SELECT ?this > WHERE { > } > > which would show the currently selected asset. If that happens to be class > then you could

Re: [topbraid-users] sparql query to show current workspace

2023-04-24 Thread Holger Knublauch
Ok thanks for the clarification. I don't see any alternative to something like SELECT ?this WHERE { } which would show the currently selected asset. If that happens to be class then you could query the other superclasses for example using SELECT ?class WHERE { ?this rdfs:subClassOf*

Re: [topbraid-users] sparql query to show current workspace

2023-04-24 Thread Kasia Kryczka
On Monday, April 24, 2023 at 2:04:59 PM UTC+2 Holger Knublauch wrote: Hi Kasia, I am not sure whether you mean TopBraid EDG or TBC, but I assume EDG. Also the term "workspace" is unclear to me, so I have to speculate a bit: SPARQL queries cannot query the state of the user interface. The

Re: [topbraid-users] sparql query to show current workspace

2023-04-24 Thread Holger Knublauch
Hi Kasia, I am not sure whether you mean TopBraid EDG or TBC, but I assume EDG. Also the term "workspace" is unclear to me, so I have to speculate a bit: SPARQL queries cannot query the state of the user interface. The only thing they have access to is the currently selected asset. Use the

[topbraid-users] sparql query to show current workspace

2023-04-24 Thread Kasia Kryczka
Hi all, Is it possible to show the current workspace we are in, i.e., when we open a class hierarchy and go to an object I would like to use a query to show exactly where I am (not the highest level of asset collection but the place I'm currently in). Unfortunately, I can't upload a

Re: [topbraid-users] Sparql Query

2021-04-29 Thread Monika Yadav
Thanku so much for your reply dear.. On Wed, Apr 28, 2021 at 6:47 PM Irene Polikoff wrote: > The answer depends on how you are associating properties with classes. > There are 3 approaches and they have different semantics and syntax: > > SHACL > > :C1 sh:property [ sh:path :hasReaction; >

Re: [topbraid-users] Sparql Query

2021-04-28 Thread Irene Polikoff
The answer depends on how you are associating properties with classes. There are 3 approaches and they have different semantics and syntax: SHACL :C1 sh:property [ sh:path :hasReaction; sh:hasValue “abscess”]. Or equivalent that is not using a blank node :C1

[topbraid-users] Sparql Query

2021-04-28 Thread mnk.ya...@gmail.com
Suppose we have classes named c1, c2,c3,c4 and c1 has property named hasReaction, C2 has property name hasadverseReaction, C3 has property named drugReaction. My question is: firstly can different classes has same property name which have diffrent values. 2nd question I wanted to retrieve all

[topbraid-users] Sparql query to find the available system memory

2021-01-01 Thread MSV
Hi, With in EDG admin page, we have a memory tab that shows us the memory stats like available memory,used memory etc. At times my application is down when some heavy ops are taking place. Is there a sparql query or something that would give me the memory that is being used,so that i can use to

[topbraid-users] SPARQL Query Question

2013-10-14 Thread Tim Smith
I have the following query: CONSTRUCT { ?s ?p ?o . } FROM urn:schemas-microsoft-com:office:spreadsheet WHERE { ?s ?p ?o . } I open the file Rows3 in the TBC workspace and run the query in a SPARQL tab. It works as expected. I create a SM script with an ImportFromWorkspace module that

Re: [topbraid-users] SPARQL Query Question

2013-10-14 Thread Holger Knublauch
Tim, could you try GRAPH (in the WHERE clause) instead of FROM? That should work consistently. Thanks Holger On Oct 15, 2013, at 6:18 AM, Tim Smith wrote: I have the following query: CONSTRUCT { ?s ?p ?o . } FROM urn:schemas-microsoft-com:office:spreadsheet WHERE { ?s ?p ?o

[topbraid-users] SPARQL query: Export results to file

2011-10-31 Thread PaulZH
TBCME 3.5.2.v20110828-2200R on Mac OSX 10.7.2 I do a SPARQL query using inferencing which takes a lot of time. I do get the wished result in the results pane of the SPARQL View. When I ask then to Export the results to file ... the query restarts, taking the same long time as previously, to

Re: [topbraid-users] SPARQL query: Export results to file

2011-10-31 Thread Holger Knublauch
On Oct 31, 2011, at 10:59 PM, PaulZH wrote: TBCME 3.5.2.v20110828-2200R on Mac OSX 10.7.2 I do a SPARQL query using inferencing which takes a lot of time. I do get the wished result in the results pane of the SPARQL View. When I ask then to Export the results to file ... the query

[topbraid-users] Sparql Query

2011-02-08 Thread John Perdoni
Hi , although I constantly try and learn, my understanding of sparql queries is still on the basic side. I am trying to construct a set of triples from members contained two classes, I have been tying to use a union statement but have not been able to get back the triples I require. I wonder if

[topbraid-users] Sparql query in TBCME

2010-04-15 Thread alexey(dot)pavloff(at)gmail(dot)com
I'm trying to run SPARQL query against pizza ontology(http://www.co- ode.org/ontologies/pizza/pizza.owl#) in TBC ME , but it returns empty result. What am I missing? PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema# PREFIX xsd: