
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
This is a Ruby implementation of a SPARQL client for RDF.rb.
RDF::Queryable
instance, using the SPARQL
gem.ASK
, SELECT
, DESCRIBE
and
CONSTRUCT
queries.RDF::Repository
instances {SPARQL::Client::Repository}.require 'sparql/client'
sparql = SPARQL::Client.new("http://dbpedia.org/sparql")
By default, SPARQL::Client adds a User-Agent
field to requests, but applications may choose to provide their own, using the headers
option:
require 'sparql/client'
sparql = SPARQL::Client.new("http://dbpedia.org/sparql", headers: {'User-Agent' => 'MyBotName'})
require 'sparql/client'
sparql = SPARQL::Client.new("http://dbpedia.org/sparql", graph: "http://dbpedia.org")
RDF::Repository
instancerequire 'rdf/trig'
repository = RDF::Repository.load("http://example/dataset.trig")
sparql = SPARQL::Client.new(repository)
# ASK WHERE { ?s ?p ?o }
result = sparql.ask.whether([:s, :p, :o]).true?
puts result.inspect #=> true or false
# 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
# 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
result = sparql.query("ASK WHERE { ?s ?p ?o }")
puts result.inspect #=> true or false
# INSERT DATA { <http://example.org/jhacker> <http://xmlns.com/foaf/0.1/name> "J. Random Hacker" .}
data = RDF::Graph.new do |graph|
graph << [RDF::URI('http://example.org/jhacker'), RDF::Vocab::FOAF.name, "J. Random Hacker"]
end
sparql.insert_data(data)
# DELETE DATA { <http://example.org/jhacker> <http://xmlns.com/foaf/0.1/name> "J. Random Hacker" .}
data = RDF::Graph.new do |graph|
graph << [RDF::URI('http://example.org/jhacker'), RDF::Vocab::FOAF.name, "J. Random Hacker"]
end
sparql.delete_data(data)
The recommended installation method is via RubyGems.
To install the latest official release of the SPARQL::Client
gem, do:
% [sudo] gem install sparql-client
To get a local working copy of the development repository, do:
% git clone git://github.com/ruby-rdf/sparql-client.git
Alternatively, download the latest development version as a tarball as follows:
% wget https://github.com/ruby-rdf/sparql-client/tarball/master
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.
.gemspec
, VERSION
or AUTHORS
files. If you need to
change them, do so on your private branch only.CREDITS
file and the corresponding
list in the the README
. Alphabetical order applies.This is free and unencumbered public domain software. For more information, see https://unlicense.org/ or the accompanying {file:UNLICENSE} file.
FAQs
Unknown package
We found that sparql-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.