开发者

RDFlib 'on disk' store

After 2 days of research I (a newby) still can't figure out what 'on disk' stores are available in RDFFlib 3.1.0. If you have a working example, that would be nice to see... For my app I prefer SQLite. I need no access to online RDF stores, I want to store info about relations inside the orga开发者_如何学Gonisation in RDF. Thanks


Here you have an example to make it work with MySQL. I don't think rdflib 3 works with SQLite.

    import rdflib
    from rdflib.Graph import ConjunctiveGraph as Graph
    from rdflib import plugin
    from rdflib.store import Store, NO_STORE, VALID_STORE

    configString = "host=localhost,user=root,password=,db=db_name"
    rt = store.open(configString,create=False)
    assert rt == VALID_STORE,"The store is corrupted"
    print "load store success"
    graph = Graph(store)
    g.parse("some.rdf")
    g.commit()

I would avoid rdflib's on-disk stores since they seem to be not very reliable and don't scale very well. As you have noticed the documentation is not great either.

If you are doing some serious work then go for triple stores like Virtuoso or 4store and use SPARQL to access the data. There are many libraries to access them with Python.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜