Class: RDF::Statement

Inherits:
Object show all
Defined in:
lib/sparql/algebra/extensions.rb

Instance Method Summary collapse

Instance Method Details

#executable?Boolean

Returns:

  • (Boolean)


396
# File 'lib/sparql/algebra/extensions.rb', line 396

def executable?; false; end

#optimize(**options) ⇒ RDF::Statement

A duplicate of this Statement.

Returns:

See Also:



392
393
394
# File 'lib/sparql/algebra/extensions.rb', line 392

def optimize(**options)
  self.dup
end

#to_sparql(**options) ⇒ String

Returns a partial SPARQL grammar for this term.

Returns:

  • (String)


382
383
384
385
# File 'lib/sparql/algebra/extensions.rb', line 382

def to_sparql(**options)
  str = to_triple.map {|term| term.to_sparql(**options)}.join(" ")
  quoted? ? ('<<' + str + '>>') : str
end

#to_sxp(prefixes: nil, base_uri: nil) ⇒ String

Returns an S-Expression (SXP) representation

Parameters:

  • prefixes (Hash{Symbol => RDF::URI}) (defaults to: nil)

    (nil)

  • base_uri (RDF::URI) (defaults to: nil)

    (nil)

Returns:

  • (String)


373
374
375
# File 'lib/sparql/algebra/extensions.rb', line 373

def to_sxp(prefixes: nil, base_uri: nil)
  to_sxp_bin.to_sxp(prefixes: prefixes, base_uri: base_uri)
end

#to_sxp_binArray

Transform Statement Pattern into an SXP

Returns:



357
358
359
360
361
362
363
364
365
# File 'lib/sparql/algebra/extensions.rb', line 357

def to_sxp_bin
  [ (has_graph? ? :quad : (quoted? ? :qtriple : :triple)),
    (:inferred if inferred?),
    subject,
    predicate,
    object,
    graph_name
  ].compact.map(&:to_sxp_bin)
end