Giter Club home page Giter Club logo

sparql-client's Introduction

SPARQL Client for RDF.rb

This is a Ruby implementation of a SPARQL client for RDF.rb.

Features

  • Executes queries against any SPARQL 1.0-compatible endpoints over HTTP.
  • Provides a query builder DSL for ASK, SELECT, DESCRIBE and CONSTRUCT queries.
  • Supports tuple result sets in both XML and JSON formats, with JSON being the preferred default for content negotiation purposes.
  • Supports graph results in any RDF serialization format understood by RDF.rb.
  • Returns results using the RDF.rb object model.
  • Supports accessing endpoints as read-only RDF::Repository instances.

Examples

require 'sparql/client'

sparql = SPARQL::Client.new("http://dbpedia.org/sparql")

Executing a boolean query and outputting the result

# ASK WHERE { ?s ?p ?o }
result = sparql.ask.whether([:s, :p, :o]).true?

puts result.inspect   #=> true or false

Executing a tuple query and iterating over the returned solutions

# SELECT * WHERE { ?s ?p ?o } OFFSET 100 LIMIT 10
query = sparql.select.where([:s, :p, :o]).offset(100).limit(10)

query.each_solution do |solution|
  puts solution.inspect
end

Executing a graph query and iterating over the returned statements

# CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o } LIMIT 10
query = sparql.construct([:s, :p, :o]).where([:s, :p, :o]).limit(10)

query.each_statement do |statement|
  puts statement.inspect
end

Executing an arbitrary textual SPARQL query string

result = sparql.query("ASK WHERE { ?s ?p ?o }")

puts result.inspect   #=> true or false

Documentation

http://sparql.rubyforge.org/client/

  • {SPARQL::Client}
    • {SPARQL::Client::Query}
    • {SPARQL::Client::Repository}

Dependencies

Installation

The recommended installation method is via RubyGems. To install the latest official release of the SPARQL::Client gem, do:

% [sudo] gem install sparql-client

Download

To get a local working copy of the development repository, do:

% git clone git://github.com/bendiken/sparql-client.git

Alternatively, download the latest development version as a tarball as follows:

% wget http://github.com/bendiken/sparql-client/tarball/master

Mailing List

Authors

Contributors

Contributing

  • Do your best to adhere to the existing coding conventions and idioms.
  • Don't use hard tabs, and don't leave trailing whitespace on any line.
  • Do document every method you add using YARD annotations. Read the tutorial or just look at the existing code for examples.
  • Don't touch the .gemspec, VERSION or AUTHORS files. If you need to change them, do so on your private branch only.
  • Do feel free to add yourself to the CREDITS file and the corresponding list in the the README. Alphabetical order applies.
  • Do note that in order for us to merge any non-trivial changes (as a rule of thumb, additions larger than about 15 lines of code), we need an explicit public domain dedication on record from you.

Resources

License

This is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying {file:UNLICENSE} file.

sparql-client's People

Contributors

artob avatar cldwalker avatar gkellogg avatar bhuga avatar fumi avatar mikaa123 avatar njh avatar pdlug avatar bad avatar jamespjh avatar drankard avatar selvan avatar

Stargazers

Angus H. avatar  avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.