rdf - How to execute SPARQL Query (Call a service) Over extracted subgraph? -


i have rdf graph several types of relations (relations same prefix , different prefixes also). need call service on graph filtering out relations.

example: enter image description here

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix mypref: <http://www.mypref.com/>. @prefix otherpref: <http://www.otherpref.com/>.  mypref:1     mypref:label "1" ;     mypref:solid mypref:2 ;     mypref:dotted mypref:4 ;     otherpref:dashed mypref:3 ;     otherpref:dashed2 mypref:3 .  mypref:2     mypref:label "2" ;     mypref:solid mypref:3 .  mypref:3     mypref:label "3" .  mypref:4     mypref:label "4" ;     mypref:dotted mypref:3 . 

i run service call on extracted sub-graph containing solid , dotted relations (in particular case, running service calculating shortest path between 1 3, want exclude direct links).

i run service (over entire graph) this:

prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. prefix mypref: <http://www.mypref.com/>. prefix otherpref: <http://www.otherpref.com/>. prefix gas: <http://www.bigdata.com/rdf/gas#>  select ?sp ?out {   service gas:service {      gas:program gas:gasclass "com.bigdata.rdf.graph.analytics.sssp" .      gas:program gas:in mypref:1 .      gas:program gas:target mypref:3 .       gas:program gas:out ?out .       gas:program gas:out1 ?sp .    } } 

how can extract subgraph containing links want (dotted , solid) , run service call on extracted sub-graph?

sparql doesn't provide functionality querying constructed graph, unfortunately. i've come across places make queries easy. endpoints have extensions support it, though. think dotnetrdf might support it. there few aspects: in many cases, it's not necessary; if endpoint supports updates, can create new named graph , construct it, , launch second query against (which pretty you're asking for, in 2 steps); expensive operation, endpoints might disable anyway, if directly supported.

the first note, though, it's times not necessary, appears might case here.

i need call service on graph filtering out relations.

in case, can query on subgraph want, think, using property paths. can ask paths built solid , dashed edges like:

?s  mypref:solid|mypref:dotted ?t 

if want arbitrary path of them, can repeat it:

?s  (mypref:solid|mypref:dotted)+ ?t 

if have unique paths between sources , destinations, can figure out lengths of paths using standard "count ways of splitting path" technique:

select (count(?t) ?length) {   ?s  (mypref:solid|mypref:dotted)* ?t   ?t  (mypref:solid|mypref:dotted)* ?u } group ?s ?t 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -