RDFlib 'on disk' store

南笙酒味 提交于 2021-01-27 07:45:26

问题


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 organisation in RDF. Thanks


回答1:


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.



来源:https://stackoverflow.com/questions/5868364/rdflib-on-disk-store

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!