-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dataset / ConjunctiveGraph #307
Comments
I started working on this in a branch (not yet pushed), and realised there is another difference:
|
@joernhees had an idea for persisting the list of graphs that "exist" - without really changing the store API. By adding a This is a bit dirty :), but maybe better than the alternative. This does not let us solve having a |
@gromgull What kind of stores are there around? We have some in-memory stores, the sleepycat one, and SPARQLStore, right? Are there other (third-party) stores, for example based on virtuoso, Jena, or Sesame? Do these stores all behave exactly like the store API requires? I could imagine that depending on the backend, the default graph is treated differently. Some could even add triples generated by a reasoner. So, maybe it would be wise to let the store decide. Also, stores could be configured by passing parameters down to them and they could tell which options they support. I know that you don't want to change the store API and I agree, but I also like to know how consistently stores implement the API. Breaking old implementations of stores is not acceptable, but maybe one could carefully do a small refinement? About adding a marker triple: Do all stores support a |
@gromgull and @iherman: I still wonder what a Store is supposed to be and how it should interact with the wild world out there. So please, can anyone comment on my last question? I was working on the SPARQLStore some weeks ago and there I am completely at the endpoint's mercy. The endpoint decides what it wants to do with the default graph and whether it stores empty graphs. I can not even know beforehand. This is why I still think that these issues should be left to the stores to some degree. |
Well... https://dvcs.w3.org/hg/rdf/raw-file/default/rdf-concepts/index.html#section-dataset There were lots of discussions in the group about that and, unfortunately, the Which means that, as you say, at the moment the endpoint decides indeed. Sigh... This is also why I believe the Dataset class in RDFLib should not use the Ivan Urs Holzer wrote:
Ivan Herman |
I and gromgull (in #301 (comment)) think that the default graph should be implemented by using a special named graph (for example Solutions for empty graphs:
Now I am at the end of my wisdom. |
Sorry for being unresponsive, I am 3 days away from changing jobs, and turns out there were quite a few things to sort out :) It doesn't seem to matter though, because @uholzer very accurately represents my opinions anyway!
These are in core rdflib. There are also a SQLAlchemy store, and a ZODB store, and various key-value stores (leveldb, kyotocabinet) that we claim to maintain. In the wild, there are stores for 4store, virtuoso, mysql, redland, postgresql, sqlite and probably more, most of which are not up-to-date as far as I know. For most stores, we control how triples/contexts are stored, and they can do whatever we decide with default graphs, unions, and tracking of empty graphs. The SPARQLStores, and the ones wrapping another RDF store (4store, virtuoso), are at the mercy of whatever they are talking to. I agree that the I would propose:
How this is actually implemented internally in the store is up to each implementation? |
For the DataSet union-default graph or not, it should be a flag when you construct the DataSet - just like Jena does it for TDB. |
it seems someone passed me the dirty solutions hat, so: |
and no, i don't really think it's a good idea, but how is a "void" triple different / worse than a special named graph? |
This would be rejected by the system, because a BNOde is not allowed as a Ivan Jörn Hees wrote:
Ivan Herman |
Urs Holzer wrote:
Yes, this is already what I proposed to do and have in my temporary
I must admit that adding something to the store interface is obviously the If we do a hack, I would actually prefer to make it meaningful. Adding a bona Ivan
Ivan Herman |
On 26.06.2013, at 06:52, Ivan Herman notifications@github.com wrote:
What system rejects it? As i recently learned rdflib is pretty much cool with everything, including BNodes as predicates or Literals as subjects ;) I thought it might be a solution to abuse the fact that rdflib can do some more stuff internally, and have the whole thing never be visible for the user. The more i think about this, the better i like the explicit solutions, adding either triples to each graph or adding a special graph. I first favored the adding triples to each graph solution, but that was when i still thought rdflib would keep the whole thing transparent to the user. Adding a special graph for tracking the graphs on the other hand at least wouldn't have that "hah look, dbpedia uses the rdflib vocabulary now" side effect. |
@joernhees |
discussed in #307 Summary of changes: * added methods ```add_graph``` and ```remove_graph``` to the Store API, implemented these for Sleepycat and IOMemory. A flag, ```graph_awareness``` is set on the store if they methods are supported, default implementations will raise an exception. * made the dataset require a store with the ```graph_awareness``` flag set. * removed the graph-state kept in the ```Dataset``` class directly. * removed ```dataset.add_quads```, ```remove_quads``` methods. The ```add/remove``` methods of ```ConjunctiveGraph``` are smart enough to work with triples or quads. * removed the ```dataset.graphs``` method - it now does exactly the same as ```contexts``` * cleaned up a bit more confusion of whether Graph instance or the Graph identifiers are passed to store methods. (#225)
"Luckily" I got to wait 2-3 hours for a doctors appointment today - and I had some time to look into this, I made a pull request with my changes, see: #309 for details. |
discussed in #307 Summary of changes: * added methods ```add_graph``` and ```remove_graph``` to the Store API, implemented these for Sleepycat and IOMemory. A flag, ```graph_awareness``` is set on the store if they methods are supported, default implementations will raise an exception. * made the dataset require a store with the ```graph_awareness``` flag set. * removed the graph-state kept in the ```Dataset``` class directly. * removed ```dataset.add_quads```, ```remove_quads``` methods. The ```add/remove``` methods of ```ConjunctiveGraph``` are smart enough to work with triples or quads. * removed the ```dataset.graphs``` method - it now does exactly the same as ```contexts``` * cleaned up a bit more confusion of whether Graph instance or the Graph identifiers are passed to store methods. (#225)
This was hopefully solved by the merge of #309 - for any remaining issues please open a new issue! |
What should
return then? |
This is not true as of commit 06dae6a.
|
You are not creating a graph in the dataset though you are creating another graph using the same store. To track the graph, it must be added with ds = Dataset(store)
g = ds.add_graph("urn:my.graph")
... |
that depends on the SPARQL query, if the query only queries the default graph, it returns nothing. |
This issue is to collect to discussion of dataset vs. conjunctive graph from: #301, #302, #303 and friends.
Similarities between ConjunctiveGraph and DataSet:
addN
,add_quad
,remove_quad
,quads
, etc.get_context
(orget_graph
), listing, deleting, etc.The difference between ConjuctiveGraph and DataSet:
Some more concerns:
I suggest:
ContextAwareGraph
, that has flags forunion_default_graph
andtrack_empty_graphs
. This class also provides quads/graph methods.Not clear to me just now:
DataSet
persisted? Looking at the current code I would say they are not. I.e. if I open aDataSet
on a Sleepycat store, create some graphs, exit my program. Next time I open, only graphs that contained triples will exists.__sub__
,__contains__
, etc. This is Think about __iadd__, __isub__ etc. for ConjunctiveGraph #225.The text was updated successfully, but these errors were encountered: