How to ignore internal EDG graphs in query

29 views
Skip to first unread message

Klaudia Augustin

unread,
Jan 2, 2023, 5:57:59 AM1/2/23
to TopBraid Suite Users
Hello,
I only want to get a list of graphs with a specific subject area but with the following query 

SELECT ?graph ?uri ?ext
WHERE {
  GRAPH ?graph {
    ?graph teamwork:externalGraphURI ?ext .
    ?graph swa:defaultNamespace ?uri .
    ?graph edg:subjectArea <urn:x-tb-governance:Locations_v2> .
  }
}

all EDG graphs are checked, too. Therefore I get this access error:
... does not have read access for graph urn:x-tb:concurrentEDGUsers

How can I ignore the internal EDG graphs in my query?

Thanks in advance, Klaudia


Holger Knublauch

unread,
Jan 2, 2023, 6:05:17 AM1/2/23
to TopBraid Suite Users
Hi Klaudia,

the problem is that the query would iterate over all graphs because the variable ?graph is not known. This is in general an inefficient query and also runs into the permission problems you mention.

This variation should work better:

SELECT ?graph ?uri ?ext
WHERE {
  () teamwork:readableGraphsUnderTeamControl (?graph ?teamGraph) .

  GRAPH ?graph {
    ?graph teamwork:externalGraphURI ?ext .
    ?graph swa:defaultNamespace ?uri .
    ?graph edg:subjectArea <urn:x-tb-governance:Locations_v2> .
  }
}

The magic property teamwork:readableGraphsUnterTeamControl will only bind ?graph to those graphs that the current user can actually read and then doing GRAPH ?graph is safe.

HTH
Holger

Klaudia Augustin

unread,
Jan 2, 2023, 8:22:24 AM1/2/23
to TopBraid Suite Users
Thanks a lot Holger. It works fine!
Reply all
Reply to author
Forward
0 new messages