History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: SES-1024
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Jeen Broekstra
Reporter: Niclas Hoyer
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Sesame

Implement retrieval of datasets by reference in FROM clause

Created: 01/Jun/12 06:43 PM   Updated: 05/Jul/12 08:12 PM
Component/s: SPARQL
Affects Version/s: None
Fix Version/s: 2.7.0


 Description   
Implement retrieval of graphs referenced by an IRI in FROM clause, see e.g. section 13.2.1

http://www.w3.org/TR/sparql11-query/#unnamedGraph

Corresponding mail with problem description:
"I would like to be able to do something like

select *
from <http://localhost/myfile.rdf> (or an on-line file)
where {?x ?y ?z}"

http://sourceforge.net/mailarchive/forum.php?thread_name=4EB95837.6060005%40uni-koblenz.de&forum_name=sesame-general


 All   Comments   Change History      Sort Order:
Comment by Jeen Broekstra [02/Jun/12 12:06 AM]
This is not how Sesame repositories are designed to behave. Normally, the FROM clause defines a repository context to include in the query dataset, rather than an external file. You are expected to first load a file into a repository. After you have done that, it becomes available for querying.

Having said that, I'm wondering if we could support a special type of repository (let's call it a FileProxyRepository) that would exhibit this kind of behavior. There are a lot of issues with respect to security and performance to solve, but it's an interesting idea.

Comment by Niclas Hoyer [02/Jun/12 12:32 PM]
That would be great. A use case for this would be verification of a WebID:

PREFIX : <http://www.w3.org/ns/auth/cert#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
ASK
FROM <http://example.com/webid.rdf#me>
WHERE {
   <http://example.com/webid.rdf#me> :key [
      :modulus "cb24ed85...d64d794b"^^xsd:hexBinary;
      :exponent 65537;
   ] .
}

See http://www.w3.org/2005/Incubator/webid/spec/#verifying-the-webid-claim

If it is possible, the FileProxyRepository could allow any URL in the FROM clause, but not store anything persistently.
Or would I have to create a FileProxyRepository for every WebID that I want to check?

Comment by Jeen Broekstra [03/Jun/12 02:11 AM]
To be honest, I don't understand why you need this new feature to achieve that. Within the current Sesame system you could simple create a new local (in-memory) repository, load the webid file into it, and then issue the query. It's ~10 lines of code:

Repository rep = new SailRepository(new MemoryStore());
rep.iniitalize();

RepositoryConnection conn = rep.getConnection();
try {
 url webid = new URL("http://example.com/webid.rdf#me");
 conn.add(webid, null, RDFFormat.RDFXML, conn.getValueFactory.creatEURI(webid.toExternalForm()));
 String queryString = "ASK FROM .... WHERE ....";
 boolean result = conn.prepareBooleanQuery(QueryLanguage.SPARQL, queryString).evaluate();
}
finally {
 conn.close();
}

You can choose to either chuck away the repository or to keep it as a local cache for reuse. You can load multiple webids into the same local store (each in its own named graph/context). It would help if you could explain why this setup is not sufficient to your needs.

Comment by Niclas Hoyer [05/Jun/12 07:08 AM]
I thought a bit about this issue now. Your solution looks fine, however I am using sesame just through the HTTP API, as the project I am working on is not java based.

Is there any way to do the same by just using HTTP? Maybe a SPARQL Update on the SYSTEM Repository?

Comment by James Leigh [05/Jul/12 08:12 PM]
Take a look at the DatasetRepository that implements the requested behaviour in very particular scenarios. It was implemented to comply with SPARQL 1.0, which requires this functionality. However, the DatasetRepository only works for SailRepositories and only for (otherwise) read-only connections.