|
Hello all, 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 ( 1
I see your point on your first query! I will try it out and inform you about the results whether they are the one expected or not. To your second query now, I learned a lot about the property paths and I am using them a lot! Thank you for your suggestions, i really apreciated! |
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 Thank you Signified for your post. I also came up the previous days with this solution and I think is the only way to mimic a static-non changeable variable. Initially i putted the OPTIONAL clause inside the GRAPH and not outside of it, but I guess this is the same since I am getting the same results. I will also ask one more question, however I will open a new question thread for it. My queries are starting slowly giving me the results I expect! Hello. I am returning to this question. You write that the ?newplaces will bind values. However from the tests that I have done, the value that is captured in ?new_places is not going to be inside the ?places variable which is what I want, because I want to have a central variable that contains all the binds. Thats why I also asked the other question some days ago and you told me to use UNION. However in this case, if I use UNION I will also get other irrelevant owl:sameAs triples. |


@Christos, welcome.
http://answers.semanticweb.com/questions/14494/welcome-to-answerssemanticwebcom
It's a little unclear to me what you would like to try. It would probably help a lot if you could edit your question to post the query you are currently trying to use.
@Christos, please do not provide additional information as an answer. Instead, edit your question, or post comments. I have taken care of converting your answer this time around.
Thank you! I appreciated it :)