Hi Fabian,
Strangely, I can't seem to reproduce this. I created the following test
and this gets the expected result from the 3rd query (I tried using a
URI instead of a literal and it still worked);
@Test
public void mergedQueriesWithPropertyPaths() throws Exception {
RepositoryConnection connection = null;
TupleQueryResult result = null;
try {
connection = getRepository().getConnection();
connection.setAutoCommit(false);
String insertData =
"INSERT DATA { " +
"ex:ann1 ex:hasLookupURI ex:ws1. " +
"ex:ws1 ex:linkedTo ex:b1 . " +
"ex:b1 ex:linkedTo ex:wordsense-prey-noun-2. " +
"ex:ann1 ex:isAnnAboutText \"text\"^^xsd:string. } ";
SparqlHelper helper = new SparqlHelper(connection);
helper.update(insertData, false);
insertData =
"INSERT DATA { " +
"ex:ann2 ex:hasLookupURI ex:ws2. " +
"ex:ws2 ex:linkedTo ex:b1 ." +
"ex:b1 ex:linkedTo ex:wordsense-snake-noun-1. " +
"ex:ann2 ex:isAnnAboutText \"text\"^^xsd:string. } ";
helper.update(insertData, false);
final String query1 =
"SELECT distinct ?text WHERE { " +
"?ann1 ex:hasLookupURI ?ws1. " +
"?ws1 ex:linkedTo{1, 2} ex:wordsense-prey-noun-2. " +
"?ann1 ex:isAnnAboutText ?text. }";
helper.tupleQuery(query1, false);
helper.verify("text", "text");
helper.verifyNoBindingsRemaining();
final String query2 =
"SELECT distinct ?text WHERE { " +
"?ann2 ex:hasLookupURI ?ws2. " +
"?ws2 ex:linkedTo{1, 2} ex:wordsense-snake-noun-1. " +
"?ann2 ex:isAnnAboutText ?text. }";
helper.tupleQuery(query2, false);
helper.verify("text", "text");
helper.verifyNoBindingsRemaining();
/// now merging the two patterns should give me the same
common result, but the resultset is empty:
final String query3 =
"SELECT distinct ?text WHERE { " +
"?ann1 ex:hasLookupURI ?ws1. " +
"?ws1 ex:linkedTo{1, 2} ex:wordsense-prey-noun-2. " +
"?ann1 ex:isAnnAboutText ?text. " +
"?ann2 ex:hasLookupURI ?ws2. " +
"?ws2 ex:linkedTo{1, 2} ex:wordsense-snake-noun-1. " +
"?ann2 ex:isAnnAboutText ?text. }";
helper.tupleQuery(query3, false);
helper.verify("text", "text");
helper.verifyNoBindingsRemaining();
} finally {
Utils.close(result);
Utils.close(connection);
}
}
And this is working with the latest OWLIM 4.3 update. Can you tell what
exact version number you are using - including build number? Also, could
you try to provide some minimal dataset that reproduces the problem?
Many thanks,
barry
On 22/03/12 08:00, Fabian Cretton wrote:
I forgot to mention something important about that "strange" behaviour:
In the final query, when I change my property path from {1, 2} to {1,
3}, the solution does appear:
SELECT distinct ?text WHERE {
?ann1 nlp:hasLookupURI ?ws1.
?ws1 wn20schema:linkedTo{1, 3} wn30:wordsense-prey-noun-2.
?ann1 nlp:isAnnAboutText ?text.
?ann2 nlp:hasLookupURI ?ws2.
?ws2 wn20schema:linkedTo{1, 3} wn30:wordsense-snake-noun-1.
?ann2 nlp:isAnnAboutText ?text.
}
Fabian
>>> Barry Norton <[email protected]> 21.03.2012 17:59 >>>
Hi, Fabian,
Is ?text bound to a literal when it succeeds in the two queries at the
top?
Barry
On 20/03/2012 14:13, Fabian Cretton wrote:
Hi,
I do have a strange behaviour that I don't understand, working with
OWLIM 4.3.
I think there is no need to provide detailed information about the
dataset to understand my problem, but will give more information if
needed.
I have some texts with lookups on wordnet.
With a query, I want to find the texts which have a look-up that is
'linkedTo' a precise wordsense.
The linkedTo property being created by my self in the store.
If I execute 2 queries about two different wordsense, the results are
correct: I get the same text as the answer
But if I merge the two wordsenses in a single query: the resultset is
empty, and I can't understand why.
Query 1: the following query returns one result:
SELECT distinct ?text WHERE {
?ann1 nlp:hasLookupURI ?ws1.
?ws1 wn20schema:linkedTo{1, 2} wn30:wordsense-prey-noun-2.
?ann1 nlp:isAnnAboutText ?text.
}
Query 2: this other query returns the same result as query 1
SELECT distinct ?text WHERE {
?ann2 nlp:hasLookupURI ?ws2.
?ws2 wn20schema:linkedTo{1, 2} wn30:wordsense-snake-noun-1.
?ann2 nlp:isAnnAboutText ?text.
}
Query 3: now merging the two patterns should give me the same common
result, but the resultset is empty:
SELECT distinct ?text WHERE {
?ann1 nlp:hasLookupURI ?ws1.
?ws1 wn20schema:linkedTo{1, 2} wn30:wordsense-prey-noun-2.
?ann1 nlp:isAnnAboutText ?text.
?ann2 nlp:hasLookupURI ?ws2.
?ws2 wn20schema:linkedTo{1, 2} wn30:wordsense-snake-noun-1.
?ann2 nlp:isAnnAboutText ?text.
}
Thank you for any help
Fabian
_______________________________________________
Owlim-discussion mailing list
[email protected]
http://ontomail.semdata.org/cgi-bin/mailman/listinfo/owlim-discussion
_______________________________________________
Owlim-discussion mailing list
[email protected]
http://ontomail.semdata.org/cgi-bin/mailman/listinfo/owlim-discussion
_______________________________________________
Owlim-discussion mailing list
[email protected]
http://ontomail.semdata.org/cgi-bin/mailman/listinfo/owlim-discussion