diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 31edd286..28efee7e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,12 +20,6 @@ jobs:
- name: Install dependencies
run: bundle install
- - name: "Verify common files are consistent"
- run: |
- git remote add -f b https://github.com/w3c/json-ld-wg.git
- git remote update
- git diff --exit-code remotes/b/main -- common
-
- name: Verify examples are consistent
run: bundle exec rake test
diff --git a/Rakefile b/Rakefile
index 1a5fda16..3ff22829 100644
--- a/Rakefile
+++ b/Rakefile
@@ -9,7 +9,8 @@ end
desc "Extract Examples"
task :examples do
sh %(rm -rf examples yaml)
- sh %(bundle exec common/extract-examples.rb --example-dir examples --yaml-dir yaml index.html)
+ sh %(wget https://w3c.github.io/json-ld-wg/common/extract-examples.rb)
+ sh %(bundle exec extract-examples.rb --example-dir examples --yaml-dir yaml index.html)
end
desc "Check HTML"
diff --git a/common/README.rb b/common/README.rb
deleted file mode 100644
index e69de29b..00000000
diff --git a/common/algorithm-terms.html b/common/algorithm-terms.html
deleted file mode 100644
index f09cb3e0..00000000
--- a/common/algorithm-terms.html
+++ /dev/null
@@ -1,119 +0,0 @@
-
- - active graph
-
- The name of the currently active graph that the processor should use when processing.
- - active object
-
- The currently active object that the processor should use when processing.
- - active property
-
- The currently active property or keyword that the processor should use when processing.
- The active property is represented in the original lexical form,
- which is used for finding coercion mappings in the active context.
- - active subject
-
- The currently active subject that the processor should use when processing.
- - add value
- -
- Used as a macro within various algorithms as a way to add a value
- to an entry in a map (object) using a specified key.
- The invocation may include an as array flag defaulting to
false.
-
- - If as array is
true
- and the value of key in object does not exist
- or is not an array, set it to a new array
- containing any original value.
- - If value is an array,
- then for each element v in value,
- use add value recursively to add v to key in entry.
- - Otherwise:
-
- - If key is not an entry in object,
- add value as the value of key in object.
- - Otherwise
-
- - If the value of the key entry in object is not an array,
- set it to a new array containing the original value.
- - Append value
- to the value of the key entry in object.
-
-
-
-
-
-
- - explicit inclusion flag
-
- A flag specifying that for properties to be included in the output,
- they must be explicitly declared in the matching frame.
- - framing state
-
- A map containing values for
- the object embed flag,
- the require all flag,
- the embedded flag,
- used internally to help determine if object embedding is appropriate,
- the explicit inclusion flag,
- and the omit default flag.
- - IRI compacting
- -
- Used as a macro within various algorithms as to reduce the language used to describe
- the process of compacting a string var representing an IRI or keyword
- using an active context either specified directly, or coming from the scope of
- the algorithm step using this term.
- An optional value is used, if explicitly provided.
- Unless specified, the vocab flag defaults to `true`,
- and the reverse flag defaults to `false`.
-
- - Return the result of using the IRI Compaction algorithm,
- passing active context,
- var,
- value (if supplied),
- vocab,
- and result.
-
-
- - IRI expanding
- -
- Used as a macro within various algorithms as to reduce the language used to describe
- the process of expanding a string value representing an IRI or keyword
- using an active context either specified directly, or coming from the scope of
- the algorithm step using this term.
- Optional defined and local context arguments are used, if explicitly provided.
- Unless specified,
- the document relative flag defaults to `false`,
- and the vocab flag defaults to `true`.
-
- - Return the result of using the IRI Expansion algorithm,
- passing active context,
- value,
- local context (if supplied),
- defined (if supplied),
- document relative,
- and vocab.
-
-
- - input frame
-
- The initial Frame provided to the framing algorithm.
- - JSON-LD input
-
- The JSON-LD data structure that is provided as input to the algorithm.
- - JSON-LD output
-
- The JSON-LD data structure that is produced as output by the algorithm.
- - map of flattened subjects
-
- A map of subjects that is the result of the
- Node Map Generation algorithm.
- - object embed flag
-
- A flag specifying that node objects should be directly embedded in the output,
- instead of being referred to by their IRI.
- - omit default flag
-
- A flag specifying that properties that are missing from the JSON-LD input,
- but present in the input frame,
- should be omitted from the output.
- - omit graph flag
-
- A flag that determines if framing output is always contained within a
@graph entry,
- or only if required to represent multiple node objects.
- - processor state
-
- The processor state,
- which includes the active context, active subject, and active property.
- The processor state is managed as a stack with elements from the previous processor state
- copied into a new processor state when entering a new JSON object.
- - require all flag
-
- A flag specifying that all properties present in the input frame
- must either have a default value
- or be present in the JSON-LD input
- for the frame to match.
-
diff --git a/common/common.js b/common/common.js
deleted file mode 100644
index 9a65f31b..00000000
--- a/common/common.js
+++ /dev/null
@@ -1,172 +0,0 @@
-/* globals require */
-/* JSON-LD Working Group common spec JavaScript */
-
-/*
-* Implement tabbed examples.
-*/
-require(["core/pubsubhub"], (respecEvents) => {
- "use strict";
-
- respecEvents.sub('end-all', (documentElement) => {
- // remove data-cite on where the citation is to ourselves.
- const selfDfns = Array.from(document.querySelectorAll("dfn[data-cite^='__SPEC__#']"));
- for (const dfn of selfDfns) {
- const anchor = dfn.querySelector('a');
- if (anchor) {
- const anchorContent = anchor.textContent;
- dfn.removeChild(anchor);
- dfn.textContent = anchorContent;
- }
- delete dfn.dataset.cite;
- }
-
- // Update data-cite references to ourselves.
- const selfRefs = document.querySelectorAll("a[data-cite^='__SPEC__#']");
- for (const anchor of selfRefs) {
- anchor.href= anchor.dataset.cite.replace(/^.*#/,"#");
- delete anchor.dataset.cite;
- }
-
- //
- // Remove/hide definitions which are unused
- // 1. Find all definitions in a termlist which are not preserved, indexed by data-cite
- // 2. Find all references to definitions not in termlist
- // 4. Hide definitions which are unreferenced
- //
- const remoteDfns = [];
- document.querySelectorAll(".termlist dfn:not(.preserve)")
- .forEach((item, index) => {
- if (!selfDfns.includes(item)) {
- remoteDfns[item.dataset["cite"]] = item;
- }
- });
-
- // termlist internal references to definitions
- const internalRefs = Array.from(document.querySelectorAll(".termlist a[data-cite]"));
-
- // all references to definitions which are not internal refs
- const allRefs = Array.from(document.querySelectorAll("a[data-cite]"))
- .filter(e => !internalRefs.includes(e));
-
- // Remove terms which are referenced
- for (const item of allRefs) {
- const cite = item.dataset["cite"];
- // Delete this from remoteDfns, as it is referenced
- delete remoteDfns[cite];
- }
-
- // Now remoteDfns only contains unreferenced terms
- for (const item of Object.values(remoteDfns)) {
- const dt = item.closest("dt");
- if(dt) {
- const dd = dt.nextElementSibling;
- // Note, removing messes up some ReSpec references, so hiding instead
- // dt.parentNode.removeChild(dt);
- // dd.parentNode.removeChild(dd);
- dt.hidden = true;
- dd.hidden = true;
- }
- }
-
- //
- // Playground
- //
-
- // Add playground links
- for (const link of document.querySelectorAll("a.playground")) {
- let pre;
- if (link.dataset.resultFor) {
- // Referenced pre element
- pre = document.querySelector(link.dataset.resultFor + ' > pre');
- } else {
- // First pre element of aside
- pre = link.closest("aside").querySelector("pre");
- }
- const content = unComment(document, pre.textContent)
- .replace(/\*\*\*\*/g, '')
- .replace(/####([^#]*)####/g, '');
- link.setAttribute('aria-label', 'playground link');
- link.textContent = "Open in playground";
-
- // startTab defaults to "expand"
- const linkQueryParams = {
- startTab: "tab-expand",
- "json-ld": content
- }
-
- if (link.dataset.compact !== undefined) {
- linkQueryParams.startTab = "tab-" + "compacted";
- linkQueryParams.context = '{}';
- }
-
- if (link.dataset.flatten !== undefined) {
- linkQueryParams.startTab = "tab-" + "flattened";
- linkQueryParams.context = '{}';
- }
-
- if (link.dataset.frame !== undefined) {
- linkQueryParams.startTab = "tab-" + "framed";
- const frameContent = unComment(document, document.querySelector(link.dataset.frame + ' > pre').textContent)
- .replace(/\*\*\*\*/g, '')
- .replace(/####([^#]*)####/g, '');
- linkQueryParams.frame = frameContent;
- }
-
- // Set context
- if (link.dataset.context) {
- const contextContent = unComment(document, document.querySelector(link.dataset.context + ' > pre').textContent)
- .replace(/\*\*\*\*/g, '')
- .replace(/####([^#]*)####/g, '');
- linkQueryParams.context = contextContent;
- }
-
- link.setAttribute('href',
- 'https://json-ld.org/playground/#' +
- Object.keys(linkQueryParams).map(k => `${encodeURIComponent(k)}=${encodeURIComponent(linkQueryParams[k])}`)
- .join('&'));
- }
-
- // Add highlighting and remove comment from pre elements
- for (const pre of document.querySelectorAll("pre")) {
- // First pre element of aside
- const content = pre.innerHTML
- .replace(/\*\*\*\*([^*]*)\*\*\*\*/g, '$1')
- .replace(/####([^#]*)####/g, '');
- pre.innerHTML = content;
- }
- });
-});
-
-function _esc(s) {
- return s.replace(/&/g,'&')
- .replace(/>/g,'>')
- .replace(/"/g,'"')
- .replace(/ s.trim()).map(s => s.search(/[^\s]/));
- const leastIndent = Math.min(...indents);
- return lines.map(s => s.slice(leastIndent)).join("\n");
-}
-
-function updateExample(doc, content) {
- // perform transformations to make it render and prettier
- return _esc(reindent(unComment(doc, content)));
-}
-
-
-function unComment(doc, content) {
- // perform transformations to make it render and prettier
- return content
- .replace(//, '')
- .replace(/< !\s*-\s*-/g, '')
- .replace(/-\s*-\s*>/g, '-->');
-}
diff --git a/common/extract-examples.rb b/common/extract-examples.rb
deleted file mode 100755
index 72fccd37..00000000
--- a/common/extract-examples.rb
+++ /dev/null
@@ -1,671 +0,0 @@
-#!/usr/bin/env ruby
-# Extracts examples from a ReSpec document, verifies that example titles are unique. Numbering attempts to replicate that used by ReSpec. Examples in script elements, which are not visibile, may be used for describing the results of related examples
-#
-# Transformations from JSON-LD
-# - @data-frame identifies the title of the frame used to process the example
-# - @data-frame-for identifies the source to apply this frame to, verifies that the no errors are encountered
-# - @data-context identifies the title of the context used to process the example
-# - @data-context-for identifies the source to apply this context to, verifies that the no errors are encountered
-# - @data-result-for identifies the title of the source which should result in the content. May be used along with @data-frame or @data-context
-# - @data-options indicates the comma-separated option/value pairs to pass to the processor
-require 'getoptlong'
-require 'json'
-require 'json/ld/preloaded'
-require 'rdf/isomorphic'
-require 'rdf/vocab'
-require 'nokogiri'
-require 'linkeddata'
-require 'fileutils'
-require 'colorize'
-require 'yaml'
-require 'cgi'
-
-# Define I18N vocabulary
-class RDF::Vocab::I18N < RDF::Vocabulary("https://www.w3.org/ns/i18n#"); end unless RDF::Vocab.const_defined?(:I18N)
-
-# FIXME: This is here until the rdf:JSON is added in RDF.rb
-unless RDF::RDFV.properties.include?( RDF.to_uri + 'JSON')
- RDF::RDFV.property :JSON, label: "JSON", comment: "JSON datatype"
-end
-
-PREFIXES = {
- dc: "http://purl.org/dc/terms/",
- dct: "http://purl.org/dc/terms/",
- dcterms:"http://purl.org/dc/terms/",
- dc11: "http://purl.org/dc/elements/1.1/",
- dce: "http://purl.org/dc/elements/1.1/",
- cred: "https://w3id.org/credentials#",
- ex: "http://example.org/",
- foaf: "http://xmlns.com/foaf/0.1/",
- prov: "http://www.w3.org/ns/prov#",
- rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
- schema: "http://schema.org/",
- xsd: "http://www.w3.org/2001/XMLSchema#"
-}
-example_dir = yaml_dir = verbose = number = line = nil
-
-opts = GetoptLong.new(
- ["--example-dir", GetoptLong::REQUIRED_ARGUMENT],
- ["--yaml-dir", GetoptLong::REQUIRED_ARGUMENT],
- ["--verbose", '-v', GetoptLong::NO_ARGUMENT],
- ["--number", '-n', GetoptLong::REQUIRED_ARGUMENT],
- ["--line", '-l', GetoptLong::REQUIRED_ARGUMENT],
-)
-opts.each do |opt, arg|
- case opt
- when '--example-dir' then example_dir = arg && FileUtils::mkdir_p(arg)
- when '--yaml-dir' then yaml_dir = arg && FileUtils::mkdir_p(arg)
- when '--verbose' then verbose = true
- when '--number' then number = arg.to_i
- when '--line' then line = arg.to_i
- end
-end
-
-num_errors = 0
-
-# Justify and remove leading and trailing blank lines from str
-# Remove highlighting and commented out sections
-def justify(str)
- str = str.
- gsub(/^\s*\s*$/, '').
- gsub('****', '').
- gsub(/####([^#]*)####/, '')
-
- # remove blank lines
- lines = str.split("\n").reject {|s| s =~ /\A\s*\z/}
-
- # count minimum leading space
- leading = lines.map {|s| s.length - s.lstrip.length}.min
-
- # remove leading blank space
- lines.map {|s| s[leading..-1]}.join("\n")
-end
-
-def table_to_dataset(table)
- repo = RDF::Repository.new
- titles = table.xpath('thead/tr/th/text()').map(&:to_s)
-
- table.xpath('tbody/tr').each do |row|
- gname, subject, predicate, object = nil
- row.xpath('td/text()').map(&:to_s).each_with_index do |cell, ndx|
- case titles[ndx]
- when 'Graph'
- gname = case cell
- when nil, '', " " then nil
- when /^_:/ then RDF::Node.intern(cell[2..-1])
- else RDF::Vocabulary.expand_pname(cell)
- end
- when 'Subject'
- subject = case cell
- when /^_:/ then RDF::Node.intern(cell[2..-1])
- else RDF::Vocabulary.expand_pname(cell)
- end
- when 'Property'
- predicate = RDF::Vocabulary.expand_pname(cell.sub("dcterms:", "dc:"))
- when 'Value'
- object = case cell
- when /^_:/ then RDF::Node.intern(cell[2..-1])
- when /^\w+:/ then RDF::Vocabulary.expand_pname(cell.sub("dcterms:", "dc:"))
- else RDF::Literal(cell)
- end
- when 'Value Type'
- case cell
- when /IRI/, '-', /^\s*$/, " "
- else
- # We might think something was an IRI, but determine that it's not
- dt = RDF::Vocabulary.expand_pname(cell.sub("dcterms:", "dc:"))
- object = RDF::Literal(object.to_s, datatype: dt)
- end
- when 'Language'
- case cell
- when '-', /^\s*$/
- else
- # We might think something was an IRI, but determine that it's not
- object = RDF::Literal(object.to_s, language: cell.to_sym)
- end
- when 'Direction'
- case cell
- when '-', /^\s*$/
- else
- object = RDF::Literal(object.to_s, datatype: RDF::URI("https://www.w3.org/ns/i18n##{object.language}_#{cell}"))
- # We might think something was an IRI, but determine that it's not
- end
- end
- end
- repo << RDF::Statement.new(subject, predicate, object, graph_name: gname)
- end
-
- repo
-end
-
-def dataset_to_table(repo)
- has_graph = !repo.graph_names.empty?
- litereals = repo.objects.select(&:literal?)
- has_datatype = litereals.any?(&:datatype?)
- has_language = litereals.any?(&:language?)
- positions = {}
-
- head = []
- head << "Graph" if has_graph
- head += %w(Subject Property Value)
-
- if has_datatype && has_language
- head += ["Value Type", "Language"]
- positions = {datatype: (has_graph ? 4 : 3), language: (has_graph ? 5 : 4)}
- elsif has_datatype
- positions = {datatype: (has_graph ? 4 : 3)}
- head << "Value Type"
- elsif has_language
- positions = {language: (has_graph ? 4 : 3)}
- head << "Language"
- end
-
- rows = []
- repo.each_statement do |statement|
- row = []
- row << (statement.graph_name || " ").to_s if has_graph
- row += statement.to_triple.map do |term|
- if term.uri? && RDF::Vocabulary.find_term(term)
- RDF::Vocabulary.find_term(term).pname.sub("dc:", "dcterms:")
- else
- term.to_s
- end
- end
-
- if has_datatype
- if statement.object.literal? && statement.object.datatype?
- row[positions[:datatype]] = RDF::Vocabulary.find_term(statement.object.datatype).pname
- else
- row[positions[:datatype]] = " "
- end
- end
-
- if has_language
- if statement.object.literal? && statement.object.language?
- row[positions[:language]] = statement.object.language.to_s
- else
- row[positions[:language]] = " "
- end
- end
-
- rows << row
- end
-
- "\n " +
- head.map {|cell| "| #{cell} | "}.join("") +
- "
\n \n " +
- rows.map do |row|
- "" + row.map {|cell| "| #{cell} | "}.join("") + "
"
- end.join("\n ") + "\n \n
"
-end
-
-# Allow linting examples
-RDF::Reasoner.apply(:rdfs, :schema)
-
-ARGV.each do |input|
- $stderr.puts "\ninput: #{input}"
- example_number = 1 # Account for imported Example 1 in typographical conventions
- examples = {}
- errors = []
- warnings = []
-
- File.open(input, "r") do |f|
- doc = Nokogiri::HTML.parse(f.read)
- doc.css(".example, .illegal-example").each do |element|
- error = nil
- warn = nil
- example_number += 1 if %w(pre aside).include?(element.name)
-
- if (title = element.attr('title').to_s).empty?
- error = "Example #{example_number} at line #{element.line} has no title"
- end
-
- if examples[title]
- warn = "Example #{example_number} at line #{element.line} uses duplicate title: #{title}"
- end
-
- def save_example(examples:, element:, title:, example_number:, error:, warn:)
- content = justify(element.inner_html)
-
- ext = case element.attr('data-content-type')
- when nil, '', 'application/ld+json' then "jsonld"
- when 'application/json' then 'json'
- when 'application/n-quads', 'nq' then 'nq'
- when 'text/html', 'html' then 'html'
- when 'text/turtle', 'ttl' then 'ttl'
- when 'application/trig', 'trig' then 'trig'
- else 'txt'
- end
-
- # Capture HTML table
- if element.name == 'table'
- ext, content = 'table', element
- end
-
- fn = "#{title.gsub(/[^\w]+/, '-')}.#{ext}"
- examples[title] = {
- title: title,
- filename: fn,
- content: content.to_s.gsub(/^\s*< !\s*-\s*-/, '').gsub(/-\s*-\s*>/, '-->'),
- content_type: element.attr('data-content-type'),
- number: example_number,
- ext: ext,
- context_for: element.attr('data-context-for'),
- context: element.attr('data-context'),
- base: element.attr('data-base'),
- ignore: element.attr('data-ignore') || element.attr('class').include?('illegal-example'),
- flatten: element.attr('data-flatten'),
- compact: element.attr('data-compact'),
- fromRdf: element.attr('data-from-rdf'),
- toRdf: element.attr('data-to-rdf'),
- frame_for: element.attr('data-frame-for'),
- no_lint: element.attr('data-no-lint'),
- frame: element.attr('data-frame'),
- result_for: element.attr('data-result-for'),
- options: element.attr('data-options'),
- target: element.attr('data-target'),
- element: element.name,
- line: element.line,
- warn: warn,
- error: error,
- }
- #puts "example #{example_number}: #{content}"
- end
-
- if element.name == 'aside'
- # If element is aside, look for sub elements with titles
- element.css('.original, .compacted, .expanded, .flattened, .turtle, .trig, .statements, .graph, .context, .frame, .framed').each do |sub|
- cls = (%w(original compacted expanded flattened turtle trig statements graph context frame) & sub.classes).first
- save_example(examples: examples,
- element: sub,
- title: "#{title}-#{cls}",
- example_number: example_number,
- error: error,
- warn: warn)
- end
- else
- # otherwise, this is the example
- save_example(examples: examples,
- element: element,
- title: title,
- example_number: example_number,
- error: error,
- warn: warn)
- end
- end
- end
-
- # Process API functions for
- examples.values.sort_by {|ex| ex[:number]}.each do |ex|
- next if number && number != ex[:number]
- next if line && line != ex[:line]
-
- xpath = '//script[@type="application/ld+json"]'
- xpath += %([@id="#{ex[:target][1..-1]}"]) if ex[:target]
- args = []
- content = ex[:content]
-
- options = ex[:options].to_s.split(',').inject({}) do |memo, pair|
- k, v = pair.split('=')
- v = case v
- when 'true' then true
- when 'false' then false
- else v
- end
- memo.merge(k.to_sym => v)
- end
- options[:validate] = true unless options.key?(:validate)
-
- $stderr.puts "example #{ex[:number]}: #{ex.select{|k,v| k != :content}.to_json(JSON::LD::JSON_STATE)}" if verbose
- $stderr.puts "content: #{ex[:content]}" if verbose
-
- if ex[:ignore]
- $stdout.write "i".colorize(:yellow)
- next
- end
-
- if ex[:error]
- errors << ex[:error]
- $stdout.write "F".colorize(:red)
- next
- end
-
- if !%w(pre script table).include?(ex[:element])
- errors << "Example #{ex[:number]} at line #{ex[:line]} has unknown element type #{ex[:element]}"
- $stdout.write "F".colorize(:red)
- next
- end
-
- # Perform example syntactic validation based on extension
- case ex[:ext]
- when 'json', 'jsonld'
- begin
- ::JSON.parse(content)
- rescue JSON::ParserError => exception
- errors << "Example #{ex[:number]} at line #{ex[:line]} parse error: #{exception.message}"
- $stdout.write "F".colorize(:red)
- $stderr.puts exception.backtrace.join("\n") if verbose
- next
- end
- when 'html'
- begin
- doc = Nokogiri::HTML.parse(content) {|c| c.strict}
- doc.errors.each do |er|
- errors << "Example #{ex[:number]} at line #{ex[:line]} parse error: #{er}"
- end
- unless doc.errors.empty?
- $stdout.write "F".colorize(:red)
- next
- end
-
- # Get base from document, if present
- html_base = doc.at_xpath('/html/head/base/@href')
- ex[:base] = html_base.to_s if html_base
-
- #script_content = doc.at_xpath(xpath)
- #content = script_content.inner_html if script_content
- content
- rescue Nokogiri::XML::SyntaxError => exception
- errors << "Example #{ex[:number]} at line #{ex[:line]} parse error: #{exception.message}"
- $stdout.write "F".colorize(:red)
- $stderr.puts exception.backtrace.join("\n") if verbose
- next
- end
- when 'table'
- content = Nokogiri::HTML.parse(content)
- when 'ttl', 'trig'
- begin
- reader_errors = []
- RDF::Repository.new << RDF::TriG::Reader.new(content, logger: reader_errors, **options)
- rescue
- reader_errors.each do |er|
- errors << "Example #{ex[:number]} at line #{ex[:line]} parse error: #{er}"
- end
- $stdout.write "F".colorize(:red)
- $stderr.puts $!.backtrace.join("\n") if verbose
- next
- end
- when 'nq'
- begin
- reader_errors = []
- RDF::Repository.new << RDF::NQuads::Reader.new(content, logger: reader_errors, **options)
- rescue
- reader_errors.each do |er|
- errors << "Example #{ex[:number]} at line #{ex[:line]} parse error: #{er}"
- end
- $stdout.write "F".colorize(:red)
- $stderr.puts $!.backtrace.join("\n") if verbose
- next
- end
- end
-
- if content.is_a?(String)
- content = StringIO.new(content)
- # Set content_type so it can be parsed properly
- content.define_singleton_method(:content_type) {ex[:content_type]} if ex[:content_type]
- end
-
- # Set API to use
- method = case
- when ex[:compact] then :compact
- when ex[:flatten] then :flatten
- when ex[:fromRdf] then :fromRdf
- when ex[:toRdf] then :toRdf
- when ex[:ext] == 'table' then :toRdf
- when %w(json ttl trig).include?(ex[:ext] )
- nil
- else
- :expand
- end
-
- # Set args to parse example content
- if ex[:frame_for]
- unless examples[ex[:frame_for]]
- errors << "Example Frame #{ex[:number]} at line #{ex[:line]} references unknown example #{ex[:frame_for].inspect}"
- $stdout.write "F".colorize(:red)
- next
- end
-
- method = :frame
- args = [StringIO.new(examples[ex[:frame_for]][:content]), content, options]
- elsif ex[:context_for]
- unless examples[ex[:context_for]]
- errors << "Example Context #{ex[:number]} at line #{ex[:line]} references unknown example #{ex[:context_for].inspect}"
- $stdout.write "F".colorize(:red)
- next
- end
-
- # Either exapand with this external context, or compact using it
- case method
- when :expand
- options[:externalContext] = content
- options[:base] = ex[:base] if ex[:base]
- args = [StringIO.new(examples[ex[:context_for]][:content]), options]
- when :compact, :flatten, nil
- options[:base] = ex[:base] if ex[:base]
- args = [StringIO.new(examples[ex[:context_for]][:content]), content, options]
- end
- elsif %w(jsonld html).include?(ex[:ext])
- # Either exapand with this external context, or compact using it
- case method
- when :expand, :toRdf, :fromRdf
- options[:externalContext] = StringIO.new(ex[:context]) if ex[:context]
- options[:base] = ex[:base] if ex[:base]
- args = [content, options]
- when :compact, :flatten
- # Fixme how to find context?
- options[:base] = ex[:base] if ex[:base]
- args = [content, (StringIO.new(ex[:context]) if ex[:context]), options]
- end
- else
- args = [content, options]
- end
-
- if ex[:result_for]
- # Source is referenced
- # Instead of parsing this example content, parse that which is referenced
- unless examples[ex[:result_for]]
- errors << "Example #{ex[:number]} at line #{ex[:line]} references unknown example #{ex[:result_for].inspect}"
- $stdout.write "F".colorize(:red)
- next
- end
-
- # Set argument to referenced content to be parsed
- args[0] = if examples[ex[:result_for]][:ext] == 'html' && method == :expand
- # If we are expanding, and the reference is HTML, find the first script element.
- doc = Nokogiri::HTML.parse(examples[ex[:result_for]][:content])
-
- # Get base from document, if present
- html_base = doc.at_xpath('/html/head/base/@href')
- options[:base] = html_base.to_s if html_base
-
- script_content = doc.at_xpath(xpath)
- unless script_content
- errors << "Example #{ex[:number]} at line #{ex[:line]} references example #{ex[:result_for].inspect} with no JSON-LD script element"
- $stdout.write "F".colorize(:red)
- next
- end
- StringIO.new(examples[ex[:result_for]][:content])
- elsif examples[ex[:result_for]][:ext] == 'html' && ex[:target]
- # Only use the targeted script
- doc = Nokogiri::HTML.parse(examples[ex[:result_for]][:content])
- script_content = doc.at_xpath(xpath)
- unless script_content
- errors << "Example #{ex[:number]} at line #{ex[:line]} references example #{ex[:result_for].inspect} with no JSON-LD script element"
- $stdout.write "F".colorize(:red)
- next
- end
- StringIO.new(script_content.to_html)
- else
- StringIO.new(examples[ex[:result_for]][:content])
- end
-
- if examples[ex[:result_for]][:content_type]
- args[0].define_singleton_method(:content_type) {examples[ex[:result_for]][:content_type]}
- end
-
- # :frame option indicates the frame to use on the referenced content
- if ex[:frame] && !examples[ex[:frame]]
- errors << "Example #{ex[:number]} at line #{ex[:line]} references unknown frame #{ex[:frame].inspect}"
- $stdout.write "F".colorize(:red)
- next
- elsif ex[:frame]
- method = :frame
- args = [args[0], StringIO.new(examples[ex[:frame]][:content]), options]
- end
-
- # :context option indicates the context to use on the referenced content
- if ex[:context] && !examples[ex[:context]]
- errors << "Example #{ex[:number]} at line #{ex[:line]} references unknown context #{ex[:context].inspect}"
- $stdout.write "F".colorize(:red)
- next
- else
- case method
- when :expand, :toRdf, :fromRdf
- options[:externalContext] = StringIO.new(examples[ex[:context]][:content]) if ex[:context]
- args = [args[0], options]
- when :compact, :flatten
- args = [args[0], ex[:context] ? StringIO.new(examples[ex[:context]][:content]) : nil, options]
- end
- end
- end
-
- # Save example
- if example_dir
- file_content = content.respond_to?(:rewind) ? (content.rewind; content.read) : content
- File.open(File.join(example_dir, ex[:filename]), 'w') {|f| f.write(file_content)}
- content.rewind if content.respond_to?(:rewind)
- end
-
- # Save example as YAML
- if yaml_dir && ex[:filename].match?(/\.json.*$/)
- fn = ex[:filename].sub(/\.json.*$/, '.yaml')
- File.open(File.join(yaml_dir, fn), 'w') do |f|
- f.puts "Example #{"%03d" % ex[:number]}: #{ex[:title]}"
- f.write(::JSON.parse(ex[:content]).to_yaml)
- end
- end
-
- # Generate result
- # * If result_for is set, this is for the referenced example
- # * otherwise, this is for this example
- begin
- ext = ex[:result_for] ? examples[ex[:result_for]][:ext] : ex[:ext]
- result = case method
- when nil then nil
- when :fromRdf
- args[0] = RDF::Reader.for(file_extension: ext).new(args[0], **options)
- opts = args.last.is_a?(Hash) ? args.pop : {}
- JSON::LD::API.fromRdf(*args, **opts)
- when :toRdf
- opts = args.last.is_a?(Hash) ? args.pop : {}
- RDF::Repository.new << JSON::LD::API.toRdf(*args, **opts)
- else
- opts = args.last.is_a?(Hash) ? args.pop : {}
- JSON::LD::API.method(method).call(*args, **opts)
- end
- rescue
- errors << "Example #{ex[:number]} at line #{ex[:line]} parse error generating result: #{$!}"
- $stdout.write "F".colorize(:red)
- $stderr.puts $!.backtrace.join("\n") if verbose
- next
- end
-
- if verbose
- if result.is_a?(RDF::Enumerable)
- $stderr.puts "result:\n" + result.to_nquads
- else
- $stderr.puts "result:\n" + result.to_json(JSON::LD::JSON_STATE)
- end
- end
-
- begin
- if ex[:result_for]
- # Compare to expected to result
- case ex[:ext]
- when 'ttl', 'trig', 'nq', 'html'
- reader = RDF::Reader.for(file_extension: ex[:ext]).new(content, **options)
- expected = RDF::Repository.new << reader
- $stderr.puts "expected:\n" + expected.to_nquads if verbose
- when 'table'
- expected = begin
- table_to_dataset(content.xpath('/html/body/table'))
- rescue
- errors << "Example #{ex[:number]} at line #{ex[:line]} raised error reading table: #{$!}"
- $stderr.puts $!.backtrace.join("\n") if verbose
- RDF::Repository.new
- end
-
- if verbose
- $stderr.puts "expected:\n" + expected.to_nquads
- $stderr.puts "result table:\n" + begin
- dataset_to_table(result)
- rescue
- errors << "Example #{ex[:number]} at line #{ex[:line]} raised error turning into table: #{$!}"
- ""
- $stderr.puts $!.backtrace.join("\n") if verbose
- end
- end
- else
- expected = ::JSON.parse(content.read)
- $stderr.puts "expected: " + expected.to_json(JSON::LD::JSON_STATE) if verbose
- end
-
- # Perform appropriate comparsion
- if expected.is_a?(RDF::Enumerable)
- if !expected.isomorphic_with?(result)
- errors << "Example #{ex[:number]} at line #{ex[:line]} not isomorphic with #{examples[ex[:result_for]][:number]}"
- $stdout.write "F".colorize(:red)
- next
- elsif !ex[:no_lint] && !(messages = expected.lint).empty?
- # Lint problems in resulting graph.
- if verbose
- messages.each do |kind, term_messages|
- term_messages.each do |term, messages|
- $stderr.puts "lint #{kind} #{term}"
- messages.each {|m| $stderr.puts " #{m}"}
- end
- end
- end
- errors << "Example #{ex[:number]} at line #{ex[:line]} has lint errors"
- $stdout.write "F".colorize(:red)
- next
- end
- else
- unless result == expected
- errors << "Example #{ex[:number]} at line #{ex[:line]} not equivalent to #{examples[ex[:result_for]][:number]}"
- $stdout.write "F".colorize(:red)
- next
- end
- end
- end
- rescue
- errors << "Example #{ex[:number]} at line #{ex[:line]} parse error comparing result: #{$!}"
- $stdout.write "F".colorize(:red)
- $stderr.puts $!.backtrace.join("\n") if verbose
- next
- end
-
- if ex[:warn]
- warnings << ex[:warn]
- $stdout.write "w".colorize(:yellow)
- else
- $stdout.write ".".colorize(:green)
- end
- end
-
- $stdout.puts "\nWarnings:" unless warnings.empty?
- warnings.each {|e| $stdout.puts " #{e}".colorize(:yellow)}
- $stdout.puts "\nErrors:" unless errors.empty?
- errors.each {|e| $stdout.puts " #{e}".colorize(:red)}
- num_errors += errors.length
-end
-
-if num_errors == 0
- $stdout.puts "\nok".colorize(:green)
-else
- exit(1)
-end
-
-exit(0)
diff --git a/common/jsonld.js b/common/jsonld.js
deleted file mode 100644
index fc33baf0..00000000
--- a/common/jsonld.js
+++ /dev/null
@@ -1,88 +0,0 @@
-const jsonld = {
- // Add as the respecConfig localBiblio variable
- // Extend or override global respec references
- localBiblio: {
- // aliases to known references
- "JSON-LD10": {
- title: "JSON-LD 1.0",
- href: "https://www.w3.org/TR/2014/REC-json-ld-20140116/",
- publisher: "W3C",
- date: "16 January 2014",
- status: "W3C Recommendation",
- authors: [
- "Manu Sporny",
- "Gregg Kellogg",
- "Marcus Langhaler"
- ]
- },
- "JSON-LD10-API": {
- title: "JSON-LD 1.0 Processing Algorithms And API",
- href: "https://www.w3.org/TR/2014/REC-json-ld-api-20140116/",
- publisher: "W3C",
- date: "16 January 2014",
- status: "W3C Recommendation",
- authors: [
- "Marcus Langhaler",
- "Gregg Kellogg",
- "Manu Sporny"
- ]
- },
- "JSON-LD10-FRAMING": {
- title: "JSON-LD Framing 1.0",
- href: "https://json-ld.org/spec/ED/json-ld-framing/20120830/",
- publisher: "W3C",
- date: "30 August 2012",
- status: "Unofficial Draft",
- authors: [
- "Manu Sporny",
- "Gregg Kellogg",
- "David Longley",
- "Marcus Langhaler"
- ]
- },
- "IEEE-754-2008": {
- title: "IEEE 754-2008 Standard for Floating-Point Arithmetic",
- href: "http://standards.ieee.org/findstds/standard/754-2008.html",
- publisher: "Institute of Electrical and Electronics Engineers",
- date: "2008"
- },
- "JSON.API": {
- title: "JSON API",
- href: "https://jsonapi.org/format/",
- authors: [
- 'Steve Klabnik',
- 'Yehuda Katz',
- 'Dan Gebhardt',
- 'Tyler Kellen',
- 'Ethan Resnick'
- ],
- status: 'unofficial',
- date: '29 May 2015'
- },
- "RFC8785": {
- title: "JSON Canonicalization Scheme (JCS)",
- href: 'https://www.rfc-editor.org/rfc/rfc8785',
- authors: ['A. Rundgren', 'B. Jordan', 'S. Erdtman'],
- publisher: 'Network Working Group',
- status: 'Informational',
- date: 'June 2020'
- },
- // These necessary as specref uses the wrong URLs
- "RFC7231": {
- title: 'Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content',
- href: 'https://tools.ietf.org/html/rfc7231',
- authors: ['R. Fielding, Ed.', 'J. Reschke, Ed'],
- pubisher: 'IETF',
- status: 'Proposed Standard',
- date: 'June 2014'
- },
- "RFC8288": {
- title: 'Web Linking',
- href: 'https://tools.ietf.org/html/rfc8288',
- authors: ['M. Nottingham'],
- pubisher: 'IETF',
- status: 'Proposed Standard',
- date: 'October 2017'
- },
- }
-};
diff --git a/common/terms.html b/common/terms.html
deleted file mode 100644
index 60446d88..00000000
--- a/common/terms.html
+++ /dev/null
@@ -1,420 +0,0 @@
-Terms imported from Other Specifications
-Terms imported from [[[ECMASCRIPT]]] [[ECMASCRIPT]], [[[RFC8259]]] [[RFC8259]], [[[INFRA]]] [[INFRA]], [[[XPATH-FUNCTIONS]]] [[XPATH-FUNCTIONS]], and [[[WEBIDL]]] [[WEBIDL]]
-
- - array
-
- In the JSON serialization,
- an array structure is represented as square brackets surrounding zero or more values.
- Values are separated by commas.
- In the internal representation,
- a list (also called an array) is an ordered collection of zero or more values.
- While JSON-LD uses the same array representation as JSON,
- the collection is unordered by default.
- While order is preserved in regular JSON arrays,
- it is not in regular JSON-LD arrays unless specifically defined
- (see the Sets and Lists section of JSON-LD 1.1.
- - boolean
-
- The values
true and false that are used
- to express one of two possible states.
- - JSON object
-
- In the JSON serialization,
- an object structure
- is represented as a pair of curly brackets surrounding zero or more name/value pairs (or members).
- A name is a string.
- A single colon comes after each name,
- separating the name from the value.
- A single comma separates a value from a following name.
- In JSON-LD the names in an object must be unique.
-
In the internal representation a JSON object is described as a
- map (see [[INFRA]]),
- composed of entries with key/value pairs.
- In the Application Programming Interface,
- a map is described using a [[WEBIDL]] record.
- - null
-
- The use of the null value within JSON-LD
- is used to ignore or reset values.
- A map entry in the
@context where the value,
- or the @id of the value, is null,
- explicitly decouples a term's association with an IRI.
- A map entry in the body of a JSON-LD document
- whose value is null
- has the same meaning as if the map entry was not defined.
- If @value, @list, or @set is set to null in expanded form,
- then the entire JSON object is ignored.
- - number
-
- In the JSON serialization, a number
- is similar to that used in most programming languages,
- except that the octal and hexadecimal formats are not used and that leading zeros are not allowed.
- In the internal representation,
- a number is equivalent to either a long
- or double,
- depending on if the number has a non-zero fractional part (see [[WEBIDL]]).
- - scalar
-
- A scalar is either a string, number,
true, or false.
- - string
-
- A string
- is a sequence of zero or more Unicode (UTF-8) characters,
- wrapped in double quotes, using backslash escapes (if necessary).
- A character is represented as a single character string.
- - Unicode code point order
- - This refers to determining the order of two Unicode strings (`A` and `B`),
- using Unicode Codepoint Collation,
- as defined in [[[XPATH-FUNCTIONS]]] [[XPATH-FUNCTIONS]],
- which defines a
- total ordering
- of strings comparing code points.
- Note that for UTF-8 encoded strings, comparing the byte sequences gives the same result as code point order.
-
-
-
-Terms imported from [[[RFC3987]]] [[RFC3987]]
-
- - IRI
-
- The absolute form of an IRI containing a scheme along with a path
- and optional query and fragment segments.
- - IRI reference
-
- Denotes the common usage of an Internationalized Resource Identifier.
- An IRI reference may be absolute or
- relative.
- However, the "IRI" that results from such a reference only includes absolute IRIs;
- any relative IRI references are resolved to their absolute form.
- - relative IRI reference
-
- A relative IRI reference is an IRI reference that is relative to some other IRI,
- typically the base IRI of the document.
- Note that properties,
- values of
@type,
- and values of terms defined to be vocabulary relative
- are resolved relative to the vocabulary mapping,
- not the base IRI.
-
-
-Terms imported from [[[RDF12-CONCEPTS]]] [[RDF12-CONCEPTS]], [[[RDF12-SCHEMA]]] [[RDF12-SCHEMA]], and [[[LINKED-DATA]]] [[LINKED-DATA]]
-
- - base IRI
-
- The base IRI is an IRI established in the context,
- or is based on the JSON-LD document location.
- The base IRI is used to turn relative IRI references into IRIs.
- - blank node
-
- A node in a graph that is neither an IRI,
- nor a literal.
- A blank node does not contain
- a de-referenceable identifier because it is either ephemeral in nature
- or does not contain information that needs to be linked to from outside of the linked data graph.
- In JSON-LD,
- a blank node is assigned an identifier starting with the prefix
_:.
- - blank node identifier
-
- A blank node identifier
- is a string that can be used as an identifier for a blank node within the scope of a JSON-LD document.
- Blank node identifiers begin with
_:.
- - dataset
-
- A dataset
- representing a collection of RDF graphs
- including exactly one default graph and zero or more named graphs.
- - datatype IRI
-
- A datatype IRI is an IRI identifying a datatype that determines how the lexical form maps to a
- literal value.
- - default graph
-
- The default graph of a dataset is an RDF graph having no name, which may be empty.
- - directional language-tagged string
-
- A directional language-tagged string
- consists of a string, a non-empty language tag as defined by [[BCP47]], and a base direction.
- The language tag must be well-formed
- according to section 2.2.9 Classes of Conformance of [[BCP47]].
- The base direction must be either `ltr` or `rtl`.
- Processors may normalize language tags to lowercase.
-
- - graph name
-
- The IRI or blank node identifying a named graph.
- - language-tagged string
-
- A language-tagged string
- consists of a string and a non-empty language tag
- as defined by [[BCP47]].
- The language tag must be well-formed
- according to section 2.2.9 Classes of Conformance of [[BCP47]].
- Processors may normalize language tags to lowercase.
-
- - Linked Data
-
- A set of documents, each containing a representation of a linked data graph or dataset.
- - RDF graph
-
- A labeled directed graph,
- i.e., a set of nodes connected by directed-arcs.
- Also called linked data graph.
-
- - list
-
- A list is an ordered sequence of IRIs, blank nodes, and literals.
- - literal
-
- An object expressed as a value such as a string or number.
- Implicitly or explicitly includes a datatype IRI and, if the datatype is `rdf:langString`, an optional language tag.
- - named graph
-
- A named graph
- is a linked data graph that is identified by an IRI or blank node.
- - node
-
- A node in an RDF graph, either the subject and object of at least one triple.
- Note that a node can play both roles (subject and object) in a graph, even in the same triple.
- - object
-
- An object is a node in a linked data graph
- with at least one incoming edge.
- - property
-
- The name of a directed-arc in a linked data graph.
- Every property is directional
- and is labeled with an IRI or a blank node identifier.
- Whenever possible, a property should be labeled with an IRI.
-
The use of
blank node identifiers to label properties is obsolete,
- and may be removed in a future version of JSON-LD.
- Also, see predicate in [[RDF12-CONCEPTS]].
- - resource
-
- A resource denoted by an IRI, a blank node or literal representing something in the world (the "universe of discourse").
- - triple
-
- A component of an RDF graph including a subject, predicate, and object, which represents
- a node-arc-node segment of an RDF graph.
- - subject
-
- A subject is a node in a linked data graph
- with at least one outgoing edge,
- related to an object node through a property.
-
-
-
-JSON-LD Specific Term Definitions
-
- - active context
-
- A context that is used to resolve terms
- while the processing algorithm is running.
- - compact IRI
-
- A compact IRI has the form of prefix:suffix
- and is used as a way of expressing an IRI without needing to define separate term definitions
- for each IRI contained within a common vocabulary identified by prefix.
- - context
-
- A set of rules for interpreting a JSON-LD document
- as described in the The Context section of JSON-LD 1.1,
- and normatively specified in the Context Definitions section of JSON-LD 1.1.
-
- - default language
-
- The default language is the language used when a string does not have a language associated with it directly.
- It can be set in the context using the
@language key
- whose value must be a string representing a [[BCP47]] language code or null.
- See the Context Definitions section of JSON-LD 1.1 for a normative description.
-
- - default object
-
- A default object is a map that has a
@default key.
- - base direction
-
- The base direction is the direction used when a string does not have a direction associated with it directly.
- It can be set in the context using the
@direction key
- whose value must be one of the strings `"ltr"`, `"rtl"`, or null.
- See the Context Definitions section of JSON-LD 1.1 for a normative description.
-
- - embedded context
-
- An embedded context is a context which appears
- as the
@context entry of one of the following:
- a node object, a value object, a graph object, a list object,
- a set object, the value of a nested property,
- or the value of an expanded term definition.
- Its value may be a map for a context definition,
- as an IRI, or as an array combining either of the above.
-
- - scoped context
-
- A scoped context is part of an expanded term definition using the
-
@context entry. It has the same form as an embedded context.
- When the term is used as a type, it defines a type-scoped context,
- when used as a property it defines a property-scoped context.
-
- - expanded term definition
-
- An expanded term definition is a term definition
- where the value is a map
- containing one or more keyword keys to define the associated IRI,
- if this is a reverse property,
- the type associated with string values, and a container mapping.
- See the Expanded Term Definition section of JSON-LD 1.1 for a normative description.
-
- - frame
-
- A JSON-LD document,
- which describes the form for transforming another JSON-LD document
- using matching and embedding rules.
- A frame document allows additional keywords and certain map entries
- to describe the matching and transforming process.
- - frame object
-
- A frame object is a map element within a frame
- which represents a specific portion of the frame matching either
- a node object or a value object
- in the input.
- See the Frame Objects section of JSON-LD 1.1 for a normative description.
-
- - graph object
-
- A graph object represents a named graph
- as the value of a map entry within a node object.
- When expanded, a graph object must have an
@graph entry,
- and may also have @id, and @index entries.
- A simple graph object
- is a graph object which does not have an @id entry.
- Note that node objects may have a @graph entry,
- but are not considered graph objects if they include any other entries.
- A top-level object consisting of @graph is also not a graph object.
- Note that a node object may also represent a named graph if it includes other properties.
- See the Graph Objects section of JSON-LD 1.1 for a normative description.
-
- - id map
-
- An id map is a map value of a term
- defined with
@container set to @id.
- The values of the id map must be node objects,
- and its keys are interpreted as IRIs representing
- the @id of the associated node object.
- If a value in the id map contains a key expanding to @id,
- its value must be equivalent to the referencing key in the id map.
- See the Id Maps section of JSON-LD 1.1 for a normative description.
-
- - implicitly named graph
-
- A named graph created from the value of a map entry
- having an expanded term definition
- where
@container is set to @graph.
- - included block
-
- An included block is an entry in a node object where the key is either `@included` or an alias of `@included`
- and the value is one or more node objects.
- See the Included Blocks section of JSON-LD 1.1 for a normative description.
-
- - index map
-
- An index map is a map value of a term
- defined with
@container set to @index,
- whose values must be any of the following types:
- string,
- number,
- true,
- false,
- null,
- node object,
- value object,
- list object,
- set object, or
- an array of zero or more of the above possibilities.
- See the Index Maps section in JSON-LD 1.1 for a formal description.
-
- - JSON literal
-
- A JSON literal is a literal where the associated datatype IRI is
rdf:JSON.
- In the value object representation, the value of @type is @json.
- JSON literals represent values which are valid JSON [[RFC8259]].
- See the The `rdf:JSON` Datatype section in JSON-LD 1.1 for a normative description.
-
- - JSON-LD document
-
- A JSON-LD document is a serialization of
- an RDF dataset.
- See the JSON-LD Grammar section in JSON-LD 1.1 for a formal description.
-
- - JSON-LD Processor
-
- A JSON-LD Processor is a system which can perform the algorithms defined in JSON-LD 1.1 Processing Algorithms and API.
- See the Conformance section in JSON-LD 1.1 API for a formal description.
-
- - JSON-LD internal representation
-
- The JSON-LD internal representation
- is the result of transforming a JSON syntactic structure
- into the core data structures suitable for direct processing:
- arrays, maps, strings, numbers, booleans, and null.
- - JSON-LD value
-
- A JSON-LD value is a string,
- a number,
-
true or false,
- a typed value,
- or a language-tagged string.
- It represents an RDF literal.
-
- - keyword
-
- A string that is specific to JSON-LD,
- described in the Syntax Tokens and Keywords section of JSON-LD 1.1,
- and normatively specified in the Keywords section of JSON-LD 1.1,
-
- - language map
-
- A language map is a map value of a term
- defined with
@container set to @language,
- whose keys must be strings representing [[BCP47]] language codes
- and the values must be any of the following types:
- null,
- string, or
- an array of zero or more of the above possibilities.
- See the Language Maps section of JSON-LD 1.1 for a normative description.
-
- - list object
-
- A list object is a map that has a
@list key.
- It may also have an @index key, but no other entries.
- See the Lists and Sets section of JSON-LD 1.1 for a normative description.
-
- - local context
-
- A context that is specified with a map,
- specified via the
@context keyword.
- - nested property
-
- A nested property is a key in a node object
- whose value is a map containing entries which are treated as if they were values of the node object.
- The nested property itself is semantically meaningless and used only to create a sub-structure within a node object.
- See the Property Nesting section of JSON-LD 1.1 for a normative description.
-
- - node object
-
- A node object represents zero or more properties of a node in the graph
- serialized by the JSON-LD document.
- A map is a node object
- if it exists outside of the JSON-LD context and:
-
- - it does not contain the
@value, @list, or @set keywords, or
- - it is not the top-most map in the JSON-LD document
- consisting of no other entries than
@graph and @context.
-
- The entries of a node object whose keys are not keywords are also called properties of the node object.
- See the Node Objects section of JSON-LD 1.1 for a normative description.
-
- - node reference
-
- A node object used to reference a node having only the
@id key.
- - prefix
-
- A prefix is the first component of a compact IRI
- which comes from a term that maps to a string that,
- when prepended to the suffix of the compact IRI,
- results in an IRI.
- - processing mode
-
- The processing mode defines how a JSON-LD document is processed.
- By default, all documents are assumed to be conformant with this specification.
- By defining a different version using the
@version entry in a context,
- publishers can ensure that processors conformant with JSON-LD 1.0 [[JSON-LD10]]
- will not accidentally process JSON-LD 1.1 documents, possibly creating a different output.
- The API provides an option for setting the processing mode to `json-ld-1.0`,
- which will prevent JSON-LD 1.1 features from being activated,
- or error if @version entry in a context is explicitly set to `1.1`.
- This specification extends JSON-LD 1.0
- via the `json-ld-1.1` processing mode.
- - set object
-
- A set object is a map that has an
@set entry.
- It may also have an @index key, but no other entries.
- See the Lists and Sets section of JSON-LD 1.1 for a normative description.
-
- - term
-
- A term is a short word defined in a context
- that may be expanded to an IRI.
- See the Terms section of JSON-LD 1.1 for a normative description.
-
- - term definition
-
- A term definition is an entry in a context,
- where the key defines a term
- which may be used within a map
- as a key, type, or elsewhere that a string is interpreted as a vocabulary item.
- Its value is either a string (simple term definition),
- expanding to an IRI,
- or a map (expanded term definition).
-
- For context processing, term definition values are converted internally to a dedicated data structure that is easier to process.
-
- - type map
-
- A type map is a map value of a term
- defined with
@container set to @type,
- whose keys are interpreted as IRIs
- representing the @type of the associated node object;
- the value must be a node object, or array of node objects.
- If the value contains a term expanding to @type,
- its values are merged with the map value when expanding.
- See the Type Maps section of JSON-LD 1.1 for a normative description.
-
- - typed value
-
- A typed value consists of a value,
- which is a string,
- and a type,
- which is an IRI.
- - value object
-
- A value object is a map that has an
@value entry.
- See the Value Objects section of JSON-LD 1.1 for a normative description.
- - vocabulary mapping
-
- The vocabulary mapping is set in the context using the
@vocab key
- whose value must be an IRI, a compact IRI, a term, or null.
- See the Context Definitions section of JSON-LD 1.1 for a normative description.
-
-
diff --git a/common/typographical-conventions.html b/common/typographical-conventions.html
deleted file mode 100644
index d1c53e34..00000000
--- a/common/typographical-conventions.html
+++ /dev/null
@@ -1,50 +0,0 @@
-The following typographic conventions are used in this specification:
-
-
- markup-
- Markup (elements, attributes, properties),
- machine processable values (string, characters, media types),
- property name,
- or a file name is in red-orange monospace font.
- - variable
-
- A variable in pseudo-code or in an algorithm description is in italics.
- - definition
-
- A definition of a term, to be used elsewhere in this or other specifications,
- is in bold and italics.
- - definition reference
-
- A reference to a definition in this document
- is underlined and is also an active link to the definition itself.
- markup definition reference-
- References to a definition in this document,
- when the reference itself is also a markup, is underlined,
- red-orange monospace font, and is also an active link to the definition itself.
- - external definition reference
-
- A reference to a definition in another document
- is underlined, in italics, and is also an active link to the definition itself.
- markup external definition reference-
- A reference to a definition in another document,
- when the reference itself is also a markup,
- is underlined, in italics red-orange monospace font,
- and is also an active link to the definition itself.
- - hyperlink
-
- A hyperlink is underlined and in blue.
- - [reference]
-
- A document reference (normative or informative) is enclosed in square brackets
- and links to the references section.
- - Changes from Recommendation
-
- Sections or phrases changed from the previous Recommendation
- may be highlighted using a control
- in .
-
-
-Notes are in light green boxes with a green left border and with a "Note" header in green.
- Notes are always informative.
-
-
- Examples are in light khaki boxes, with khaki left border,
- and with a numbered "Example" header in khaki.
- Examples are always informative. The content of the example is in monospace font and may be syntax colored.
-
- Examples may have tabbed navigation buttons
- to show the results of transforming an example into other representations.
-
diff --git a/index.html b/index.html
index 2860eaf5..3498ddf0 100644
--- a/index.html
+++ b/index.html
@@ -4,8 +4,8 @@
JSON-LD 1.2 Processing Algorithms and API
-
-
+
+