github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

pius / sparql

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 11
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Provides a parsing expression grammar for SPARQL and allows the user to interface SPARQL with arbitrary datastores. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

changed license to the Lesser GPL 
pius (author)
Fri Jul 18 20:14:11 -0700 2008
commit  7ba4c82eee94e60e53225a4149e0b41ad680b2d8
tree    7c39b3b4a183a7f65a00627fe947fed1cd9be9fa
parent  30d37348b0691f9692b22854e0324dc1cb38a006
sparql /
name age
history
message
file COPYING Fri Jul 18 20:14:11 -0700 2008 changed license to the Lesser GPL [pius]
file COPYING.lesser Fri Jul 18 20:14:11 -0700 2008 changed license to the Lesser GPL [pius]
file ChangeLog Thu Jul 17 11:44:03 -0700 2008 added a ChangeLog [pius]
file README.markdown Fri Jul 18 20:14:11 -0700 2008 changed license to the Lesser GPL [pius]
file Rakefile Tue Jul 15 07:04:27 -0700 2008 initial commit with basic SELECT parsing support [pius]
directory coverage/ Wed Jul 16 21:38:59 -0700 2008 the library is finally ready for other folks to... [pius]
directory lib/ Fri Jul 18 20:14:11 -0700 2008 changed license to the Lesser GPL [pius]
file sparql.gemspec Tue Jul 15 07:04:27 -0700 2008 initial commit with basic SELECT parsing support [pius]
directory spec/ Fri Jul 18 20:14:11 -0700 2008 changed license to the Lesser GPL [pius]
README.markdown

sparql Release 0.0.1 (July 17th 2008)

Git: http://github.com/pius/sparql
Author: Pius Uzamere, The Uyiosa Corporation

Copyright: Pius Uzamere © 2008 License: The Lesser GNU Public License

SYNOPSIS

sparql is a library for Ruby that formally implements the SPARQL grammar as a parsing expression grammar (PEG). The grammar is implemented in a fantastic syntax language called Treetop.

FEATURE LIST

  1. As of right now (00:10 EST, July 17, 2008) can parse basic SPARQL statements, check the test cases for precisely what it can support: When finished, this library will be able to parse arbitrary SPARQL queries and can serve as a maintainable reference implementation in Ruby.

  2. Starting point for providing SPARQL endpoints for arbitrary datastores: When completed, this library will provide hooks that allow a Ruby developer to easily define a translation from SPARQL to another query language or API of their choosing. Ideally, this will be done using a simple YAML configuration file.

  3. Fully Composable: Because parsing expression grammars are closed under composition, you can compose this grammar with other Treetop grammars with relative ease.

USAGE

Though this library only parses a small subset of SPARQL and I've not added all of the API methods yet, it is ready to start playing with.

  1. Install the Gem

Make sure you've upgraded to RubyGems 1.2. Then, if you've never installed a gem from GitHub before then do this:

> gem sources -a http://gems.github.com (you only have to do this once)

Then:

> sudo gem install pius-sparql

  1. Make Sure You've Got the Dependencies installed

sparql depends on Treetop (http://github.com/nathansobo/treetop).

> sudo gem install treetop

  1. Require the gem in your code, play with it

As of this minute, the code won't be that useful to you, as it can only parse a small subset of SPARQL and the translation hooks have not been added yet. That being said, stay tuned. I think development on this is going to move fairly quickly because Treetop is such a joy to write the PEG in.

Anyway, you can get started by doing the following in IRB.

> irb(main):001:0> require 'rubygems'

> => true

> irb(main):002:0> gem 'pius-sparql'

> => true

> irb(main):003:0> require 'sparql'

> => true

> irb(main):004:0> parser = SparqlParser.new

> => #SparqlParser:0x1270bcc @consume_all_input=true

> irb(main):005:0> syntaxtree = parser.parse('SELECT ?foo ?bar WHERE { ?x foaf:knows ?y . ?z foaf:name ?y . }')

  1. Read the documentation

Actually, read the tests -- they will show you the forms that are supported. Take a look at lib/sparql/sparql.treetop and get a sense of the grammar. In addition, check out the formal specification of the SPARQL grammar so you can see how the Treetop grammar relates to it.

  1. Contribute!

Fork my repository (http://github.com/pius/sparql), make some changes, and send along a pull request!

The best way to contribute is to add a test case for a specific SPARQL query that does not parse and then tweak the grammar such that your new test case plus all the others pass.

COPYRIGHT


sparql was created in 2008 by Pius Uzamere (pius -AT- alum -DOT- mit -DOT- edu) and is
licensed under the LGPL.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server