Is it possible to write generic SPARQL CONSTRUCT query that will return me the whole graph starting from root node? As result I want to have all Graph triples.

Ontology:

example:Node
  rdf:type owl:Class ;
  rdfs:subClassOf owl:Thing .

example:next
  rdf:type owl:ObjectProperty ;
  rdfs:domain example:Transformation ;
  rdfs:range example:Transformation .

example:node1 a example:Node.
example:node2 a example:Node.
example:node3 a example:Node.
example:node4 a example:Node.
example:node5 a example:Node.

Graph

example:node1 example:next example:node2.
example:node1 example:next example:node3.
example:node2 example:next example:node4.
example:node3 example:next example:node4.
example:node3 example:next example:node5.

*EDIT*

Mathematically speaking, I have a Rooted graph. And I want to get the whole graph starting from the root node.

asked 07 Dec '12, 15:17

artem's gravatar image

artem
12
accept rate: 0%

edited 12 Dec '12, 11:59

I'm not sure what you mean. What do you expect the result to be? Are you trying to say that example:next is a transitive property ie.

if:

example:node1 example:next example:node2.
example:node2 example:next example:node4.

then you want to infer

example:node1 example:next example:node4.

Or do you just want to replicate the graph as is using SPARQL?

(09 Dec '12, 12:54) Sweet Burlap Sweet%20Burlap's gravatar image
1

@artem, please edit your question to include the SPARQL query that you have tried, and why it doesn't do what you want.

(09 Dec '12, 20:38) Jeen Broekstra ♦ Jeen%20Broekstra's gravatar image

@Sweet Burlap, the second one. See my edit.

(12 Dec '12, 12:01) artem artem's gravatar image

As far as I can tell from your description, a simple

CONSTRUCT WHERE {?x example:next ?y}

will give you the result you want.

permanent link

answered 13 Dec '12, 14:00

Jeen%20Broekstra's gravatar image

Jeen Broekstra ♦
11.6k412
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1,299
×107

question asked: 07 Dec '12, 15:17

question was seen: 1,010 times

last updated: 13 Dec '12, 14:00