@@ -132,7 +132,12 @@ Example data and context used throughout examples below:
132132
133133### Compact
134134
135- [ Compact] ( http://json-ld.org/spec/latest/json-ld/#compacted-document-form ) .
135+ [ Compaction] ( http://json-ld.org/spec/latest/json-ld/#compacted-document-form ) is
136+ the process of applying a developer-supplied context to shorten IRIs to terms or
137+ compact IRIs, and JSON-LD values expressed in expanded form to simple values
138+ such as strings or numbers. Often this makes it simpler to work with a document
139+ as the data is expressed in application-specific terms. Compacted documents are
140+ also typically easier to read for humans.
136141
137142``` csharp
138143var doc = JObject .Parse (_docJson );
@@ -161,7 +166,11 @@ Output:
161166
162167### Expand
163168
164- [ Expand] ( http://json-ld.org/spec/latest/json-ld/#expanded-document-form ) .
169+
170+ [ Exapansion] ( http://json-ld.org/spec/latest/json-ld/#expanded-document-form ) is
171+ the process of taking a JSON-LD document and applying a @context such that all
172+ IRIs, types, and values are expanded so that the @context is no longer
173+ necessary.
165174
166175``` csharp
167176var expanded = JsonLdProcessor .Expand (compacted );
@@ -208,7 +217,11 @@ Output:
208217
209218### Flatten
210219
211- [ Flatten] ( http://json-ld.org/spec/latest/json-ld/#flattened-document-form ) .
220+ [ Flattening] ( http://json-ld.org/spec/latest/json-ld/#flattened-document-form )
221+ collects all properties of a node in a single JSON object and labels all blank
222+ nodes with blank node identifiers. This ensures a shape of the data and
223+ consequently may drastically simplify the code required to process JSON-LD in
224+ certain applications.
212225
213226``` csharp
214227var doc = JObject .Parse (_docJson );
@@ -246,7 +259,17 @@ Output:
246259
247260### Frame
248261
249- [ Frame] ( http://json-ld.org/spec/latest/json-ld-framing/#introduction ) .
262+ [ Framing] ( http://json-ld.org/spec/latest/json-ld-framing/#introduction ) is used
263+ to shape the data in a JSON-LD document, using an example frame document which
264+ is used to both match the flattened data and show an example of how the
265+ resulting data should be shaped. Matching is performed by using properties
266+ present in the frame to find objects in the data that share common values.
267+ Matching can be done either using all properties present in the frame, or any
268+ property in the frame. By chaining together objects using matched property
269+ values, objects can be embedded within one another.
270+
271+ A frame also includes a context, which is used for compacting the resulting
272+ framed output.
250273
251274For the framing example below, the framing document is defined as follows:
252275
@@ -376,7 +399,20 @@ Output:
376399
377400### ToRDF
378401
379- (N-Quads)
402+ JSON-LD is a concrete RDF syntax as described in [ RDF 1.1 Concepts and Abstract
403+ Syntax] [ rdf-11-concepts ] . Hence, a JSON-LD document is both an RDF document and a
404+ JSON document and correspondingly represents an instance of an RDF data model.
405+ The procedure to deserialize a JSON-LD document to an
406+ [ RDF dataset] [ rdf-11-dataset ] (and, optionally, to [ RDF N-Quads] [ n-quads ] )
407+ involves the following steps:
408+
409+ 1 . Expand the JSON-LD document, removing any context; this ensures that
410+ properties, types, and values are given their full representation as IRIs and
411+ expanded values.
412+ 1 . Flatten the document, which turns the document into an array of node objects.
413+ 1 . Turn each node object into a series of RDF N-Quads.
414+
415+ The processor's ` ToRDF ` method carries out these steps for you, like this:
380416
381417``` csharp
382418var doc = JObject .Parse (_docJson );
@@ -399,7 +435,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person
399435*/
400436```
401437
402- _ or_ using a custom RDF renderer object
438+ _ or_ using a custom RDF renderer object, like this:
403439
404440``` csharp
405441private class JSONLDTripleCallback : IJSONLDTripleCallback
@@ -431,7 +467,17 @@ internal static void Run()
431467
432468### FromRDF
433469
434- (N-Quads)
470+ Serialization from RDF N-Quads into JSON-LD can be thought of as the inverse of
471+ the last of the three steps described in summary Deserialization described in
472+ the ` ToRDF ` method documentation above. Serialization creates an expanded
473+ JSON-LD document closely matching the N-Quads from RDF, using a single node
474+ object for all N-Quads having a common subject, and a single property for those
475+ N-Quads also having a common predicate.
476+
477+ In practice, it looks like this:
478+
479+ _ the variable ` serialized ` is populated with RDF N-Quads values resulting from
480+ the code in the ` ToRDF ` example above_
435481
436482``` csharp
437483var opts = new JsonLdOptions ();
@@ -544,6 +590,10 @@ internal static void Run()
544590
545591### Custom DocumentLoader
546592
593+ By replacing the default ` documentLoader ` object placed on the JsonLdProcessor,
594+ it is possible to alter the behaviour when retrieving a remote document (e.g. a
595+ context document) required to execute a given algorithm (e.g. Expansion).
596+
547597``` csharp
548598public class CustomDocumentLoader : DocumentLoader
549599{
@@ -648,6 +698,10 @@ https://github.com/linked-data-dotnet/json-ld.net
648698 [ json-ld-wg-api-latest ] : https://w3c.github.io/json-ld-api/
649699 [ json-ld-wg-framing-latest ] : https://w3c.github.io/json-ld-framing/
650700
701+ [ n-quads ] : https://www.w3.org/TR/n-quads/
702+ [ rdf-11-concepts ] : https://www.w3.org/TR/rdf11-concepts/
703+ [ rdf-11-dataset ] : https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-dataset
704+
651705 [ nuget ] : https://www.nuget.org/packages/json-ld.net/
652706 [ nuget-badge ] : https://img.shields.io/nuget/v/json-ld.net.svg
653707
0 commit comments