Home > pysparql

pysparql

Pysparql is a project mainly written in Python, based on the View license.

SPARQL lexer and parser library for Python

h1. PySPARQL README

This is the Python version of "sparql-grammar":http://github.com/gkellogg/sparql-grammar library which was originally written in Ruby.

h2. Dependencies

  • "Python":http://www.python.org/ >= 2.5
  • "YaRDFLib":http://github.com/knorex/yardflib

h2. Examples


>>> from pysparql import Parser
>>> query = "SELECT ?name WHERE { ?x rdf:type foaf:Person . ?x foaf:name ?name }"
>>> p = Parser(query)
>>> p.parse()
>>> print p.result
['project', [Variable(?name)], Query(None)[['triple', Variable(?x), URI(type), URI(Person)], ['triple', Variable(?x), URI(name), Variable(?name)]]]

h2. Author

  • "Knorex Pte. Ltd.":http://www.knorex.com

h2. License

PySPARQL is freely available for all uses under a BSD license.

Previous:avtoru