Module: SPARQL::Client::Update

Defined in:
lib/sparql/client/update.rb

Overview

SPARQL 1.1 Update operation builders.

Defined Under Namespace

Classes: Add, Clear, Copy, Create, DeleteData, DeleteInsert, Drop, InsertData, Load, Move, Operation

Class Method Summary collapse

Class Method Details

.clear(*arguments) ⇒ Object

Clear the graph

Examples:

CLEAR GRAPH <example.org/data.rdf>

clear.graph(RDF::URI(http://example.org/data.rdf))
clear(:graph, RDF::URI(http://example.org/data.rdf))

CLEAR DEFAULT

clear.default
clear(:default)

CLEAR NAMED

clear.named
clear(:named)

CLEAR ALL

clear.all
clear(:all)

CLEAR SILENT ALL

clear.all.silent
clear(:all, silent: true)


84
85
86
# File 'lib/sparql/client/update.rb', line 84

def self.clear(*arguments)
  Clear.new(*arguments)
end

.create(*arguments) ⇒ Object

Create a graph

Examples:

CREATE GRAPH <example.org/data.rdf>

create(RDF::URI(http://example.org/data.rdf))

CREATE SILENT GRAPH <example.org/data.rdf>

create(RDF::URI(http://example.org/data.rdf)).silent
create(RDF::URI(http://example.org/data.rdf), silent: true)

Parameters:

  • options (Hash{Symbol => Object})


99
100
101
# File 'lib/sparql/client/update.rb', line 99

def self.create(*arguments)
  Create.new(*arguments)
end

.delete_data(*arguments) ⇒ Object

Delete statements from the graph

Examples:

DELETE DATA { <example.org/jhacker> <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
delete_data(data)

DELETE DATA { GRAPH <example.org/> {}}

delete_data(RDF::Graph.new, :graph => 'http://example.org/')
delete_data(RDF::Graph.new).graph('http://example.org/')

Parameters:

  • data (Array<RDF::Statement>, RDF::Enumerable)
  • options (Hash{Symbol => Object})


37
38
39
# File 'lib/sparql/client/update.rb', line 37

def self.delete_data(*arguments)
  DeleteData.new(*arguments)
end

.drop(*arguments) ⇒ Object

Drop a graph

Examples:

DROP GRAPH <example.org/data.rdf>

drop.graph(RDF::URI(http://example.org/data.rdf))
drop(:graph, RDF::URI(http://example.org/data.rdf))

DROP DEFAULT

drop.default
drop(:default)

DROP NAMED

drop.named
drop(:named)

DROP ALL

drop.all
drop(:all)

DROP ALL SILENT

drop.all.silent
drop(:all, silent: true)


127
128
129
# File 'lib/sparql/client/update.rb', line 127

def self.drop(*arguments)
  Drop.new(*arguments)
end

.insert_data(*arguments) ⇒ Object

Insert statements into the graph

Examples:

INSERT DATA { <example.org/jhacker> <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
insert_data(data)

INSERT DATA { GRAPH <example.org/> {}}

insert_data(RDF::Graph.new, :graph => 'http://example.org/')
insert_data(RDF::Graph.new).graph('http://example.org/')

Parameters:

  • data (Array<RDF::Statement>, RDF::Enumerable)
  • options (Hash{Symbol => Object})


19
20
21
# File 'lib/sparql/client/update.rb', line 19

def self.insert_data(*arguments)
  InsertData.new(*arguments)
end

.load(*arguments) ⇒ Object

Load statements into the graph

Examples:

load(RDF::URI(http://example.org/data.rdf))

LOAD SILENT <example.org/data.rdf>

load(RDF::URI(http://example.org/data.rdf)).silent
load(RDF::URI(http://example.org/data.rdf), silent: true)

load(RDF::URI(http://example.org/data.rdf)).into(RDF::URI(http://example.org/data.rdf))
load(RDF::URI(http://example.org/data.rdf), into: RDF::URI(http://example.org/data.rdf))

Parameters:

  • from (RDF::URI)
  • options (Hash{Symbol => Object})
  • [RDF::URI] (Hash)

    a customizable set of options

  • [Boolean] (Hash)

    a customizable set of options



56
57
58
# File 'lib/sparql/client/update.rb', line 56

def self.load(*arguments)
  Load.new(*arguments)
end