A toolkit for accessing RDF graphs as plain objects.
Project description
Oort is a a Python-based toolkit for accessing RDF graphs as plain objects.
It uses RDFLib for the heavy lifting.
Overview
- oort.rdfview
Contains classes and functions used for defining RDF queries and selectors, i.e. declarations used to pick properties and associated sub-queries from a chosen resource (similar to how many ORM-toolkits work).
- oort.util.queries
Some basic base RdfQuery subtypes for common use (e.g. getting at localized annotation properties such as rdfs:label and similar).
- oort.util.graphs
A collection of basic “filesystem-to-graph” utilities.
How?
By subclassing oort.rdfview.RdfQuery and adding attributes which are instances of one of the Selector subclasses from that package, you define a set of rdf properties which are to be retrieved about a given subject (from a given graph, in a given language). The selectors are given a URIRef which determines the property. Or a Namespace, in which case the name of the attribute will be used.
These are some of the predefined classes from oort.util.queries:
class Typed(RdfQuery):
rdfType = one(RDF.type)
class Labelled(RdfQuery):
label = localized(RDFS)
class Annotated(Labelled):
comment = localized(RDFS)
class Resource(Annotated, Typed):
pass
Selectors can also be given RdfQuery types (or names of types, to enable e.g. cyclic references) which are used to describe their selected resources recursively. Use like this:
SIOC = Namespace("http://rdfs.org/sioc/ns#")
class Item(Annotated):
_rdfbase_ = SIOC # sets default namespace base for this RdfQuery
name = localized()
description = localized()
seeAlso = each(RDFS) >> Annotated
The overloaded >> is just sugar for:
seeAlso = each(RDFS).viewed_as(Annotated)
Predefined selectors in oort.rdfview are: one, each, one_where_self_is, each_where_self_is, collection, localized, i18n_dict, each_localized and localized_xml.
RdfQueries are either directly instantiated with an RDFLib Graph instance, language (string) and URIRef instance, or used via QueryContext, which facilitates this and other things.
Se more examples (and test source code) at the Oort Website.
The latest development version can be installed from the Oort SVN Trunk.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Oort-0.4.tar.gz.
File metadata
- Download URL: Oort-0.4.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bb7acd2effd143a3f60739efd81eaea03d9d4c77ee4165cc9f046dc940c40fc
|
|
| MD5 |
944ce5ac7ad7c555f4d0b48ae29c23d8
|
|
| BLAKE2b-256 |
7220142323cb4a8e5d4d17800eb7a16caa41b94da2f2f6ae3ac0c266d401d99c
|
File details
Details for the file Oort-0.4-py2.5.egg.
File metadata
- Download URL: Oort-0.4-py2.5.egg
- Upload date:
- Size: 44.0 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9a8c34fc3714a3a7f923c54843bb3d22ca926318f9d39b9acc8dc66f4d8bacc
|
|
| MD5 |
6b0787318bfe0d2ce497934ad1674fff
|
|
| BLAKE2b-256 |
e99f279763f0108d3c76fc534f6c0aee532b7b71e62498a48ffc96fece66856c
|