SPARQL property path for identifying downstream targets of a directed interaction

30 views
Skip to first unread message

Matt Karikomi

unread,
Sep 24, 2020, 5:23:41 PM9/24/20
to wikipathways-discuss
Hi,

First, I just want to say thanks for creating the wp RDF resource.  I think you have done a really  great job balancing the vocabulary of WP in terms of usability and level of detail!

I am attempting to get all "(ancestor,descendent)" pairs where "ancestor" is a source and "descendent" is a target of some arbitrary sequence of directed interactions.  Here is an example using WP3655 (the simplest one I could find):

Query 1:
```

SELECT DISTINCT ?pathway ?src ?tgt
WHERE {

   ?pathway a wp:Pathway .
   ?interaction dcterms:isPartOf ?pathway .
   ?interaction a wp:DirectedInteraction .
   ?interaction wp:source ?src .
   ?interaction wp:target ?tgt .
   ?src (wp:source/^wp:target)+ ?tgt .
   ?pathway dcterms:identifier "WP3655"^^xsd:string .
}
LIMIT 1000
```

From a brief inspection of WP 3655, Query 1 should return at least the following pair:

Representing the path:

However, I get no pairs from Query 1.

*Can this be refactored in some way?*

Best, Matt

Matt Karikomi

unread,
Sep 24, 2020, 6:10:34 PM9/24/20
to wikipathways-discuss
Ok I think there was a bug in the original query.
Replace original with the following property path:
"  ?src (^wp:source/wp:target)+ ?tgt . "
Which translates to:
("find ?directedInteraction that ?src is the source of" ->
"find ?tgt that is the target of ?directedInteraction")+

Query 2:
```

SELECT DISTINCT ?pathway ?src ?tgt
WHERE {

   ?pathway a wp:Pathway .
   ?interaction dcterms:isPartOf ?pathway .
   ?interaction a wp:DirectedInteraction .
   ?interaction wp:source ?src .
   ?interaction wp:target ?tgt .
   ?src (^wp:source/wp:target)+ ?tgt .
   ?pathway dcterms:identifier "WP3655"^^xsd:string .
    FILTER(?src != ?tgt)
}
LIMIT 10
```
I've also included "FILTER(?src != ?tgt)" in an attempt to include only simple paths (no loops).
Unfortunately even with only "LIMIT 10" records I'm getting a response that suggests something weird is going on:

"Virtuoso 42000 Error TN...: Exceeded 1000000000 bytes in transitive temp memory. use t_distinct, t_max or more T_MAX_memory options to limit the search or increase the pool"

Thanks, Matt
Reply all
Reply to author
Forward
0 new messages