Module: JSON::LD

Defined in:
lib/json/ld.rb,
lib/json/ld/format.rb,
lib/json/ld/reader.rb,
lib/json/ld/writer.rb,
lib/json/ld/normalize.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

Modules: VERSION Classes: Format, JSONLD, Normalize, Reader, Writer

Constant Summary collapse

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

Instance Method Summary collapse

Class Method Details

.debug=(value) ⇒ Object



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

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

.debug?Boolean

Returns:

  • (Boolean)


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

def self.debug?; @debug; end

Instance Method Details

#normalize(graph) ⇒ Object

Normalize a graph, returning a new graph with node names normalized



113
114
115
116
# File 'lib/json/ld/normalize.rb', line 113

def normalize(graph)
  norm = Normalize.new
  norm.normalize
end