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.
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#
> :key [
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?
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());
RepositoryConnection conn = rep.getConnection();
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();
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.
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?
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.