Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Semantic Web and RDF library for Python

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 docs
Octocat-spinner-32 examples
Octocat-spinner-32 pymantic
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .hgignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rst
Octocat-spinner-32 pymantic.wpr
Octocat-spinner-32 setup.cfg
Octocat-spinner-32 setup.py
README.rst

Pymantic

Semantic Web and RDF library for Python

Quick Start

>>> from pymantic.rdf import *
>>> from pymantic.parsers import turtle_parser
>>> from urllib2 import urlopen
>>> Resource.prefixes['foaf'] = Prefix('http://xmlns.com/foaf/0.1/')
>>> graph = turtle_parser.parse(urlopen('https://raw.github.com/norcalrdf/pymantic/master/examples/foaf-bond.ttl'))
>>> bond_james = Resource(graph, 'http://example.org/stuff/Bond')
>>> print "%s knows:" % (bond_james.get_scalar('foaf:name'),)
>>> for person in bond_james['foaf:knows']:
        print person.get_scalar('foaf:name')

Requirements

Pymantic requires Python 2.6 or higher. Lepl is used for the Turtle and NTriples parser. httplib2 is used for HTTP requests and the SPARQL client. simplejson and lxml are required by the SPARQL client as well.

Install

$ python setup.py install

This will install Pymantic and all its dependencies.

Documentation

Generating a local copy of the documentation requires Sphinx:

$ easy_install Sphinx
Something went wrong with that request. Please try again.