Project

rdf-jena

0.0
No commit activity in last 3 years
No release in over 3 years
Implements an RDF.rb repository for Apache Jena running on JRuby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.7
~> 10.4
~> 2.0.0
~> 2.0.0
~> 4.2
~> 3.2
~> 0.8

Runtime

~> 2.0.0
 Project Readme

rdf-jena

RDF Storage backed by Apache Jena and running on JRuby.

Works on JRuby 1.7 and 9k series.

Install

gem install rdf-jena

Use

require 'rdf/jena'

# Create TDB directory 'data'.
r = RDF::Jena::Repository.new('data')

# Insert a statement into the default graph (Jena's default model for the TDB dataset).
r << RDF::Statement.new(
  RDF::URI('https://github.com/abargnesi'),
  RDF::URI('http://purl.org/dc/terms/created'),
  RDF::URI('https://github.com/abargnesi/rdf-jena')
)

# Work with graphs.

  # Create repository data source for graph.
  graph_repository = RDF::Repository.new(:graph_name=>'https://github.com')
  graph_repository << RDF::Statement.new(
    RDF::URI('https://github.com/abargnesi/rdf-jena'),
    RDF::URI('http://purl.org/dc/terms/requires'),
    RDF::URI('https://github.com/ruby-rdf/rdf')
  )

  # Create named graph from repository.
  graph = RDF::Graph.new('https://github.com', :data => graph_repository)

  # Insert as a named graph into repository (Added as a named model to the TDB dataset).
  r.insert_graph(graph)

  # You can also:
  
    # replace a graph
    r.replace_graph(graph)

    # delete a graph
    r.delete_graph(graph)