Module: JSON::LD

Defined in:
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/writer.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/utils.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/to_rdf.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/streaming_writer.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/resource.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/reader.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/from_rdf.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/frame.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/format.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/flatten.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/expand.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/context.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/compact.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-0276ccfc5aaa/lib/json/ld/api.rb

Overview

JSON::LD is a JSON-LD extension 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: Compact, Expand, Flatten, Frame, FromRDF, StreamingWriter, ToRDF, Utils, VERSION Classes: API, BlankNodeMapper, BlankNodeNamer, BlankNodeUniqer, Context, Format, JsonLdError, Reader, Resource, Writer

Constant Summary

INITIAL_CONTEXT =

Initial context

{
  RDF.type.to_s => {"@type" => "@id"}
}.freeze
KEYWORDS =
%w(
  @base
  @container
  @context
  @default
  @embed
  @explicit
  @id
  @index
  @graph
  @language
  @list
  @nest
  @omitDefault
  @requireAll
  @reverse
  @set
  @type
  @value
  @version
  @vocab
).freeze
NC_REGEXP =

Regexp matching an NCName.

Regexp.new(
%{^
  (?!\\\\u0301)             # ́ is a non-spacing acute accent.
                            # It is legal within an XML Name, but not as the first character.
  (  [a-zA-Z_]
   | \\\\u[0-9a-fA-F]
  )
  (  [0-9a-zA-Z_\.-]
   | \\\\u([0-9a-fA-F]{4})
  )*
$},
Regexp::EXTENDED)
NATIVE_DATATYPES =

Datatypes that are expressed in a native form and don't expand or compact

[RDF::XSD.integer.to_s, RDF::XSD.boolean.to_s, RDF::XSD.double.to_s]
JSON_STATE =
JSON::State.new(
  indent:       "  ",
  space:        " ",
  space_before: "",
  object_nl:    "\n",
  array_nl:     "\n"
)