This is my first post on the forums. I found plenty of answers to my questions in the forum however sometimes I have difficulties to find out exactly what I want. This is why I am asking you now.
i don't know if the title of this post can explain what I want however I will try to explain it here in more details.
So I have a variable ?place that matches some values from the named graph 1. Lets say it matched the graph1:New_York value. Then I want to pass this variable to the second named graph in the form of ?place_graph_2 owl:sameAs ?place and get the matches that I found there. However what I will get is the following example:
graph2:New_York owl:sameAs graph1:New_York
This is the answer that I want however then the query will not stop and it will practically match every owl:sameAs triple that is on named graph 2. So in addition I will get the triple graph2:London owl:sameAs graph2:London_2.
I don't want to receive answers that have nothing to do with the initial content of ?name variable which means that graph2:London and graph2:London_2 even if they are bound with owl:sameAs are irrelevant to me!
So to summarize and make the question even more general. Is there a way that a variable will maintain its content and only get bigger when there is a specific match?
Thank you for your time!
Update so here is an example query:
With this query I will take as a result from the first graph that: dbpedia:New_York owl:sameAs dataset_1:New_York
Then on the second graph I will get as a result: dataset_2:New_York owl:sameAs dataset_1:New_York (this is because the ?places variable already had this value matched from the graph 1 and it also bound with a triple from graph 2), however, I will also get the triples: dataset_2:London owl:sameAs dataset_1:London and dataset_2:dog owl:sameAs dbpedia:dog, which is irelevant to me, because I wanted to match only values that where from before inside the ?places (only the dataset_1:New_York value) and not everyhing which binds with the ?new_places owl:sameAs ?place triple pattern.
Seems like a slightly strange request, but okay. :)
There could be more elegant ways to do this using (e.g.) property paths if
which would be ...
I now roughly understand what you mean by "growing" the bindings for a variable that is already bound ... to perform a disjunction (
answered 20 Nov '12, 14:04
The problem is that you are using a
This is actually simpler. Just get rid of the
answered 11 Nov '12, 12:20
Jeen Broekstra ♦
Just based on this comment for Jeen's answer, sounds like you're looking for
This will keep all values bound for
Please see the appropriate section of the SPARQL spec. for more details and some examples of
answered 12 Nov '12, 17:38