graphWithImports doesn't work with temp graphs ?

27 views
Skip to first unread message

Nicolas Fouqué

unread,
Mar 29, 2022, 4:17:38 AM3/29/22
to TopBraid Suite Users
Hi, 
I'm developing a service that selects resources in a graph specified in parameter, in some cases, this is done on EDG graphs and I used ui:graphWithImports to make my selection properly.
But recently a new use case has emerged where I have to use this service with a temporary graph, and it seems like calling "ui:graphWithImports" on my temp graph makes it fail.
Is there a way to make that work without having to move all my usage of ui:graphWithImports ?

Thanks in advance,

Nicolas

Holger Knublauch

unread,
Mar 29, 2022, 4:21:18 AM3/29/22
to topbrai...@googlegroups.com

Is this from inside an SWP script, and are you using ui:tempGraph?

Holger

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/8da2f100-3e47-4a52-8668-d221e88cdcc4n%40googlegroups.com.

Nicolas Fouqué

unread,
Mar 29, 2022, 4:26:13 AM3/29/22
to TopBraid Suite Users
It is from inside a SWP script but now that you mention it I am not using the standard ui:tempGraph, I added a UUID to it because there was concern of the graph modifications colliding with other services.
Nicolas

Nicolas Fouqué

unread,
Mar 29, 2022, 5:27:04 AM3/29/22
to TopBraid Suite Users
I don't know if that would be relevant to point out since all graphs starting with ui:tempGraph are supposed to work the same though

Richard Cyganiak

unread,
Mar 29, 2022, 5:30:01 AM3/29/22
to topbraid-users list
Hi Nicolas,

Temp graphs are not visible to certain parts of the system, such as the logic that resolves imports.

I'm not sure if this will help you, but if you need to access a temp graph together with some other graphs, the function ui:unionOfGraphs(?g1, ?g2, ...) might be useful. This function returns a “magic” graph name that contains the triples from all the argument graphs, and it works with temp graphs. For example, this will work in SWP:

    <ui:setContext ui:queryGraph="{= ui:unionOfGraphs(ui:tempGraph, <urn:x-evn-master:my-asset-collection>)) }">

Wrapping the non-temp graph in ui:graphWithImports(...) will also work as expected.

(Adding a UUID to the temp graph name is not necessary as temp graphs are scoped to the currently running SWP engine instance, and each separate HTTP request will get a separate SWP engine instance. Good practice is to choose a temp graph name that is unique to your service/component, e.g., ui:tempGraphMyCustomExporter.)

Richard


Nicolas Fouqué

unread,
Mar 29, 2022, 6:07:19 AM3/29/22
to TopBraid Suite Users
Hi Richard, 

Thank you for your answer, it is clear now why that doesn't work.
The thing is, these two graphs are passed through the same parameter, so I would have to test whether the graph is a temp graph, what would be the most efficient way to do this ?

Thanks, 
Nicolas

Richard Cyganiak

unread,
Mar 29, 2022, 6:10:29 AM3/29/22
to topbraid-users list
Nicolas,

On 29 Mar 2022, at 11:07, Nicolas Fouqué <nfouque...@gmail.com> wrote:

The thing is, these two graphs are passed through the same parameter, so I would have to test whether the graph is a temp graph, what would be the most efficient way to do this ?

Something like:

    STRSTARTS(STR(?graph), STR(ui:tempGraph))

If this returns true, it's a temp graph.

Richard


Reply all
Reply to author
Forward
0 new messages