Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abargnesi/rdf-jena
RDF.rb storage implementation for Apache Jena
https://github.com/abargnesi/rdf-jena
Last synced: 7 days ago
JSON representation
RDF.rb storage implementation for Apache Jena
- Host: GitHub
- URL: https://github.com/abargnesi/rdf-jena
- Owner: abargnesi
- License: apache-2.0
- Created: 2015-11-18T02:58:47.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-06-08T08:38:41.000Z (over 8 years ago)
- Last Synced: 2024-10-19T12:58:36.456Z (about 1 month ago)
- Language: Java
- Size: 83.5 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this 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
```ruby
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)
```