Code Monkey home page Code Monkey logo

rdflib-postgresql's Introduction

NOTE - this code is not maintained, and not guaranteed to work with newer versions of rdflib!

For RDBMS based persistence for RDFLib we recommend you use

https://github.com/RDFLib/rdflib-sqlalchemy


PostgreSQL :: a formula-aware RDFLib Store based on AbstractSQLStore

PostgreSQL RDFLib Store, formula-aware implementation. It stores its triples in the following partitions (per AbstractSQLStore):

  • Asserted non rdf:type statements
  • Asserted rdf:type statements (in a table which models Class membership). The motivation for this partition is primarily query speed and scalability as most graphs will always have more rdf:type statements than others
  • All Quoted statements

In addition it persists namespace mappings in a separate table

Requires RDFLib 3.

Install with:

$ pip install rdflib_postgresql

Basic usage:

>>> from rdflib import Graph, URIRef
>>> configString = "user=postgresql dbname=rdflibpostgresql_test"
>>> g = Graph('PostgreSQL', identifier=URIRef("http://example.com/g43"))
>>> g.open(configString, create=True)
1
>>> print(g)
<http://example.com/g43> a rdfg:Graph;rdflib:storage 
                    [a rdflib:Store;rdfs:label 'PostgreSQL'].
>>> print(g.store)
<Parititioned PostgreSQL N3 Store>
>>> print(g.identifier)
http://example.com/g43
>>> g.close()
>>> 

Build Status

rdflib-postgresql's People

Contributors

bcroq avatar gromgull avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rdflib-postgresql's Issues

__len__ miscounts statements in multiple contexts.

Test that reveals the bug.

    def testLenInMultipleContexts(self):
        oldLen = len(self.graph)
        self.addStuffInMultipleContexts()

        # addStuffInMultipleContexts is adding the same triple to
        # three different contexts. So it's only + 1
        self.assertEquals(len(self.graph), oldLen + 1)
        graph = Graph(self.graph.store, self.c1)
        self.assertEquals(len(graph), oldLen + 1)

The assertion "self.assertEquals(len(self.graph), oldLen + 1)" fails.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.