Module: JSON::LD

Defined in:
lib/json/ld.rb,
lib/json/ld/format.rb,
lib/json/ld/reader.rb,
lib/json/ld/writer.rb

Overview

**‘JSON::LD`** is a JSON-LD plugin for RDF.rb.

Examples:

Requiring the ‘JSON::LD` module

require 'json/ld'

Parsing RDF statements from a JSON-LD file

JSON::LD::Reader.open("etc/foaf.jld") do |reader|
  reader.each_statement do |statement|
    puts statement.inspect
  end
end

See Also:

Author:

Defined Under Namespace

Classes: Format, JSONLD, Reader, Writer

Constant Summary collapse

BASE =

Keywords

'@base'.freeze
COERCE =
'@coerce'.freeze
CONTEXT =
'@context'.freeze
DATATYPE =
'@datatype'.freeze
IRI =
'@iri'.freeze
LANGUAGE =
'@language'.freeze
LITERAL =
'@literal'.freeze
SUBJECT =
'@subject'.freeze
TYPE =
'@type'.freeze
VOCAB =
'@vocab'.freeze
DEFAULT_CONTEXT =

Default context

{
  '@coerce'       => {
    IRI  => [TYPE]
  }
}.freeze
DEFAULT_COERCE =

Default type coercion, in property => datatype order

{
  TYPE            => IRI,
  RDF.first.to_s  => false,            # Make sure @coerce isn't generated for this
  RDF.rest.to_s   => IRI,
}.freeze

Class Method Summary collapse

Class Method Details

.debug=(value) ⇒ Object



58
# File 'lib/json/ld.rb', line 58

def self.debug=(value); @debug = value; end

.debug?Boolean

Returns:

  • (Boolean)


57
# File 'lib/json/ld.rb', line 57

def self.debug?; @debug; end