LD Patch for RDF.rb

This is a Ruby implementation of LD Patch for RDF.rb.

Gem Version Build Status Coverage Status

Description

This gem implements the LD Patch specification with a couple of changes and/or limitations:

LD Patch is useful inside a Rack container where it can respond to POST messages to affect the modification of a target graph identified using the URL of the POST.

Features

Documentation

Full documentation available on Rubydoc.info

Examples

require 'rubygems'
require 'ld/patch'

Example Patch

queryable = RDF::Repository.load("etc/doap.ttl")
patch = %(
  @prefix doap: <http://usefulinc.com/ns/doap#> .
  @prefix earl: <http://www.w3.org/ns/earl#> .
  @prefix foaf: <http://xmlns.com/foaf/0.1/> .

  Delete { <> a earl:TestSubject, earl:Software } .
  Add {
    <http://greggkellogg.net/foaf#me> a foaf:Person;
      foaf:name "Gregg Kellogg"
  } .
  Bind ?ruby <> / doap:programming-language .
  Cut ?ruby .
)
operator = LD::Patch.parse(patch, base_uri: "http://rubygems.org/gems/ld-patch")
operator.execute(queryable) # alternatively queryable.query(operator)

Implementation Notes

The reader uses the EBNF gem to generate first, follow and branch tables, and uses the Parser and Lexer modules to implement the LD Patch parser.

The parser takes branch and follow tables generated from the LD Patch Grammar described in the specification. Branch and Follow tables are specified in the generated {LD::Patch::Meta}.

Dependencies

Mailing List

Author

Contributing

This repository uses Git Flow to mange development and release activity. All submissions must be on a feature branch based on the develop branch to ease staging and integration.

License

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

A copy of the LD Patch EBNF and derived parser files are included in the repository, which are not covered under the UNLICENSE. These files are covered via the W3C Document License.