openRDF.org Welcome Guest   | Login   
  Search  
  Index  | Recent Threads  | Who's Online  | User List  | Search  | Help  | RSS feeds

Forum closing down
This forum will be closing down due to extensive spamming activities. As a first step, registration of new members has been disabled. Existing members will be able to use the forum for now, but please consider using the sesame-general mailing list instead.


Quick Go »
Thread Status: Normal
Total posts in this thread: 6
[Add To My Favorites] [Watch this Thread] [Post new Thread]
Author
Previous Thread This topic has been viewed 2017 times and has 5 replies Next Thread
May 16, 2007 3:26:55 PM

sschenk
Member



Joined: Dec 1, 2005
Posts: 15
Status: Offline

SPARQL datasets Reply to this Post
Reply with Quote

Dear all,

Currently Sesame 2 completely ignores SPARQL dataset declarations.
As a result if we have for example the following data:

ex:g1{s1 p1 o1.}
ex:g2{s2 p2 o2.}

the following query:

SELECT ?s
FROM g1
WHERE {?s ?p ?o.}

would return s1 and s2, which is obviously a wrong result.

As I really need this feature, I'd like to know whether it is planned to implement this soon?

Otherwise I would give it a try myself. An approach could be to extend the query with a dataset definition and to have triple sources which can be limited to specific datasets. I guess this could also be valuable for query optimisation, as the search space would be significantly reduced. Usually the dataset specified in a query uses only some of the potentially many contexts in a repository.

What do you think?

Best,
Simon
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
May 30, 2007 1:46:46 PM

jeen
Sesame Addict
Member's Avatar

The Netherlands
Joined: Jan 23, 2004
Posts: 1091
Status: Offline
Re: SPARQL datasets Reply to this Post
Reply with Quote

You are right that dataset declarations are not (yet) supported in Sesame 2, but given your example, could you not simply use named graph support instead (which is supported)?

SELECT ?s
WHERE
{
GRAPH g1
{?s ?p ?o.}
}

Assuming you have stored your two datasets in separate contexts in the same repository, this will work.

To answer your other question: although generally speaking we do intend to support SPARQL completely, we do not have this particular feature scheduled for implementation soon. If you feel like giving it a shot yourself, we'd of course welcome that! You can find some starting points for setting up your development environment on our Aduna Wiki page. I also recommend that you subscribe to the Sesame developers mailinglist (if you haven't done so yet). Let us know if you need anything.
----------------------------------------
Researcher at AFSG - Wageningen UR
Show Printable Version of Post     [Link] Report threatening or abusive post: please login first  Go to top 
May 31, 2007 4:15:51 PM

sschenk
Member



Joined: Dec 1, 2005
Posts: 15
Status: Offline

Re: SPARQL datasets Reply to this Post
Reply with Quote

 
You are right that dataset declarations are not (yet) supported in Sesame 2, but given your example, could you not simply use named graph support instead (which is supported)?


Unfortunately not, because the above was only an illustrative example. On the one hand I need to handle queries like the following, where datatype support is crucial:


SELECT ?g
FROM NAMED <http://test/g1>
FROM NAMED <http://test/g2>
WHERE
{
GRAPH g?
{?s ?p ?o.}
}


On the other hand I currently do pattern matching on the query string for the implementation of the networked graphs SAIL, which is not the best solution. For a version supporting distributed evaluation against graphs stored at different endpoints, I need to know the dataset of a query. Hence, the query object model needs to be extended anyway.

 
Let us know if you need anything.


I have done an implementation today.
The SPARQLparser now handles datasets, ParsedQueries know their datasets and the TripleSources use them. If no dataset is defined in a query or the query is written in a different query language, the dataset is null and the behaviour is as before.

How can I send you my code changes?

Code Changes:
* create class Dataset
* create DatasetDeclProcessor which creates a Dataset from a ASTQueryContainer
* modify SPARQLParser to use DatasetDeclProcessor to set dataset of query
* extend ParsedQuery with getters and setters for dataset
* Extend TripleSource.getStatements with an additional parameter scope
* Modify MemTripleSource and NativeTripleSource to conform to the new interface and correctly handle Datasets
* Modify MemTripleSource and NativeTripleSource to accept a dataset as an additional parameter of the costructor and the respective connections to supply these parameters. (This is not yet perfect)
* Modify EvaluationStrategyImpl to use the extended getStatements. Also move the handling of named context statements into the triple sources.

Quick Test results:
data:
http://test/c1: {<http://test/s1> <http://test/p> <http://test/s1>.}
http://test/c2: {<http://test/s2> <http://test/p> <http://test/s1>.}

0) =============================================
query:
SELECT ?x
FROM <http://test/c1>
FROM NAMED <http://test/c2>
WHERE {?x ?y ?z.}
expect single result s1.
result:
http://test/s1
1) =============================================
query:
SELECT ?x
FROM <http://test/c1>
FROM NAMED <http://test/c2>
WHERE {GRAPH <http://test/c2> {?x ?y ?z.}}
expect single result s2.
result:
http://test/s2
2) =============================================
query:
SELECT ?x
FROM <http://test/c1>
FROM NAMED <http://test/c2>
WHERE {GRAPH <http://test/c1> {?x ?y ?z.}}
expect empty result.
result:
3) =============================================
query:
SELECT ?x
FROM <http://test/c1>
FROM NAMED <http://test/c2>
WHERE {GRAPH ?g {?x ?y ?z.}}
expect single result s2.
result:
http://test/s2
4) =============================================
query:
SELECT ?x
WHERE {GRAPH ?g {?x ?y ?z.}}
expect results s1 and s2.
result:
http://test/s1
http://test/s2
5) =============================================
query:
SELECT ?x
WHERE {?x ?y ?z.}
expect results s1 and s2.
result:
http://test/s1
http://test/s2

best regards,
Simon
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Jun 1, 2007 10:38:44 AM

jeen
Sesame Addict
Member's Avatar

The Netherlands
Joined: Jan 23, 2004
Posts: 1091
Status: Offline
Re: SPARQL datasets Reply to this Post
Reply with Quote

That was quick biggrin

Can you send your improvements to me in a zip file or as an eclipse patch? jeen.broekstra at aduna-software dot com.

I will take a look and see how we can best integrate this in our code base. Thanks!
----------------------------------------
Researcher at AFSG - Wageningen UR
Show Printable Version of Post     [Link] Report threatening or abusive post: please login first  Go to top 
May 24, 2008 8:02:20 PM

turnguard
Regular
Member's Avatar


Joined: Mar 22, 2008
Posts: 34
Status: Offline
Re: SPARQL datasets Reply to this Post
Reply with Quote

aloha,
i can see that the changes made it to sesame2 , yet i still can't get any result from sparql - queries with FROM and FROM NAMED in it.

is there anything left to change for the developer?

any help appreciated

turnguard
www.2sea.org
Show Printable Version of Post        Hidden to Guest    http://www.2sea.org    tschyrgie [Link] Report threatening or abusive post: please login first  Go to top 
May 25, 2008 7:20:05 PM

arjohn
OpenRDF project lead
Member's Avatar

The Netherlands
Joined: Jan 23, 2004
Posts: 1289
Status: Offline
Re: SPARQL datasets Reply to this Post
Reply with Quote

Sesame repositories, or at least the ones that are currently available, do not load datasets in response to a specification in a query by default. You can wrap your repository in a DatasetRepository, which will do this for you.
----------------------------------------
Arjohn Kampman, OpenRDF project lead, Aduna
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
[Show Printable Version of Thread] [Post new Thread]