Coder Social home page Coder Social logo

rdf-trig's Introduction

RDF::TriG reader/writer

TriG reader/writer for RDF.rb .

Gem Version Build Status Coverage Status Gitter chat

Description

This is a Ruby implementation of a TriG reader and writer for RDF.rb.

Features

RDF::TriG parses TriG into statements or quads. It also serializes to TriG.

Install with gem install rdf-trig

  • 100% free and unencumbered public domain software.
  • Implements a complete parser and serializer for TriG.
  • Compatible with Ruby 3.x, and JRuby 9+.
  • Optional streaming writer, to serialize large graphs

Usage

Instantiate a reader from a local file:

repo = RDF::Repository.load("etc/doap.trig", :format => :trig)

Define @base and @prefix definitions, and use for serialization using :base_uri an :prefixes options.

Canonicalize and validate using :canonicalize and :validate options.

Write a repository to a file:

RDF::TriG::Writer.open("etc/test.trig") do |writer|
   writer << repo
end

Note that reading and writing of graphs is also possible, but as graphs have only a single context, it is not particularly interesting for TriG.

RDF-star

Both reader and writer include provisional support for RDF-star.

Internally, an RDF::Statement is treated as another resource, along with RDF::URI and RDF::Node, which allows an RDF::Statement to have a #subject or #object which is also an RDF::Statement.

Note that this requires the rdfstar option to be se.

Note: This feature is subject to change or elimination as the standards process progresses.

Documentation

Full documentation available on Rubydoc.info.

Principle Classes

  • {RDF::TriG::Format}
  • {RDF::TriG::Reader}
  • {RDF::TriG::Writer}

Implementation Notes

This version uses a hand-written parser using the Lexer from the [EBNF][] gem instead of a general [EBNF][] LL(1) parser for faster performance.

The reader uses the Turtle parser. The writer also is based on the Turtle writer.

The syntax is compatible with placing default triples within {}, but the writer does not use this for writing triples in the default graph.

There is a new :stream option to {RDF::TriG::Writer} which is more efficient for streaming large datasets.

Change Log

See Release Notes on GitHub

Dependencies

Installation

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

% [sudo] gem install rdf-trig

Mailing List

Author

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, which you will be asked to agree to on the first commit to a repo within the organization. Note that the agreement applies to all repos in the Ruby RDF organization.

License

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

A copy of the TriG 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.

rdf-trig's People

Contributors

gkellogg avatar

Stargazers

Magical Cosmic Particle avatar Christoph Fabianek avatar  avatar James Benner avatar Riccardo Tommasini avatar Fumihiro Kato avatar  avatar Arnau Siches avatar Arto Bendiken avatar

Watchers

 avatar Justin Coyne avatar Chris Beer avatar Aymeric Brisse avatar David Butler avatar Julien Pervillé avatar James Cloos avatar Dorian Taylor avatar tamsin woo avatar  avatar

Forkers

fumi

rdf-trig's Issues

Error updating

C:\Users\Dominic E Sisneros>gem update
Updating installed gems
Updating rdf-trig
ERROR: Error installing rdf-trig:
conflicting dependencies ebnf (> 2.0) and ebnf (> 1.2)
Activated ebnf-1.2.0
which does not match conflicting dependency (~> 2.0)

Conflicting dependency chains:
rdf-trig (= 3.1.1), 3.1.1 activated, depends on
rdf-turtle (> 3.1), 3.1.0 activated, depends on
ebnf (
> 1.2), 1.2.0 activated

versus:
rdf-trig (= 3.1.1), 3.1.1 activated, depends on
ebnf (~> 2.0)

Updating sorbet
ERROR: Error installing sorbet:
Unable to resolve dependency: No match for 'sorbet-static (= 0.5.5843)' on this platform. Found: java, universal-darwin-14, universal-darwin-15, universal-darwin-16, universal-darwin-17, universal-darwin-18, universal-darwin-19, x86_64-linux
Nothing to update

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.