SQL Database Adapter

This wraps either a local or remote SQL Database

The schema is assumed to follow:

This uses the rdftab library to build an RDF-level statements table, on which numerous SQL Views are layered, providing higher level access

Initialization

If you omit a scheme and specify a filesystem path ending with .db then the SqlDatabase implementation is selected, with sqlite as a sub-scheme.

You can explicitly specify a sqlite database via a selector sqlite:path/to/sqlitefile.db

Code

SQL Alchemy ORM Model

We use the SQLA Models from the semantic-sql project.

This is under-the-hood and users of oaklib don’t need to know the details. However, if you ever need to craft a custom complex query this can provide a useful way to do this.

class semsql.sqla.semsql.Statements(**kwargs)[source]

Represents an RDF triple

class semsql.sqla.semsql.Edge(**kwargs)[source]

A relation graph edge that connects two entities by a predicate. Note an edge is distinct from a statement, in that an axiom such as A SubClassOf R some B is represented as multiple statements, but is a single relation graph edge

class semsql.sqla.semsql.EntailedEdge(**kwargs)[source]

A relation graph edge that is inferred