Before I continue, I wanted to clarify some things concerning graphs. What's the difference from "default" graphs and "named" graphs as defined by the FROM and FROM NAMED clause respectively? Because it seems that the rdflib SPARQL code treats both kinds of graphs virtually the same and adds them both to the default graph (ie. base data set).
>From my understanding of the specs, the default graph is to consist of the graphs defined by the FROM clause. The graphs defined by the FROM NAMED clause are ADDITIONAL graphs that might be called upon by the GRAPH clause. So, they should not be included in the base data set. Is this correct? On top of that, you also have the "default-graph-uri" and "named-graph-uri" parameters defined by the SPARQL HTTP protocol. As well, what happens in the case of when the GRAPH clause gets a variable and the value for that variable is a uri that that has not been listed by any of the above? For example: ?s foaf:homepage ?g GRAPH ?g { ... } A custom graph resolving mechanism will need to take all of these into careful considerations. -----Original Message----- From: Chimezie Ogbuji [mailto:[EMAIL PROTECTED] Sent: Saturday, October 27, 2007 11:17 PM To: Sidney Cc: dev@rdflib.net; [EMAIL PROTECTED] Subject: Re: [rdflib-dev] Major updates to SPARQL implementation On 10/27/07, Sidney <[EMAIL PROTECTED]> wrote: > Is it possible to add a mechanism for custom "graph resolving"? That's a pretty good idea. The closest thing for that (currently) is rdflib.sparql.Algebra.LoadGraph(datasetURI,datasetBaseURI,graph) This is used by the SPARQL evaluation engine to resolve dataset expressions. Unfortunately, this part of the specification triggers normative dependencies on URI formatting, resolution, etc.. (for which vanilla Python 2.4+ does a poor job). So, the current LoadGraph attempts to use a more compliant URI resolution library (Ft.Lib.Uri) if it is available. So, theoretically, you should be able to: .. stuff .. from rdflib.sparql import Algebra Algebra.LoadGraph = yourFunc graph.query('..sparql query...',...) In order to have your own LoadGraph method do the dataset resolution, it would simply need to populate the given graph with the triples serialized by the representation that corresponds with the given URI. > An abstract class would be something as followed: > > class GraphResolver: > > def resolve(self, uri): > # return graph given by param uri > > So, whenever the SPARQL processor needs to resolve a graph, it calls the > client's graph resolver to return the desired graph. So, the main difference here would be that a (new?) graph is returned by the resolver instead of populating a given graph. -- Chimezie _______________________________________________ Dev mailing list Dev@rdflib.net http://rdflib.net/mailman/listinfo/dev