0% found this document useful (0 votes)
70 views4 pages

Package Jsonld': R Topics Documented

The jsonld package provides functions for working with JSON-LD documents, including compacting, expanding, flattening, framing, and converting between JSON-LD and RDF formats. It wraps the JavaScript library for JSON-LD processing and accepts/returns JSON strings, working with linked data.

Uploaded by

mauricioville
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views4 pages

Package Jsonld': R Topics Documented

The jsonld package provides functions for working with JSON-LD documents, including compacting, expanding, flattening, framing, and converting between JSON-LD and RDF formats. It wraps the JavaScript library for JSON-LD processing and accepts/returns JSON strings, working with linked data.

Uploaded by

mauricioville
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Package ‘jsonld’

May 3, 2018
Type Package
Title JSON for Linking Data
Version 2.0
Description JSON-LD is a light-weight syntax for expressing linked data. It is primarily
intended for web-based programming environments, interoperable web services and for
storing linked data in JSON-based databases. This package provides bindings to the
JavaScript library for converting, expanding and compacting JSON-LD documents.
License BSD_3_clause + file LICENSE

URL https://github.com/ropensci/jsonld#readme (devel)


https://www.w3.org/TR/json-ld (spec)

BugReports https://github.com/ropensci/jsonld/issues
Imports V8, jsonlite, curl (>= 2.7)
RoxygenNote 5.0.1.9000
Suggests spelling
Language en-US
NeedsCompilation no
Author Jeroen Ooms [aut, cre] (<https://orcid.org/0000-0002-4035-0289>),
rOpenSci [fnd] (https://ropensci.org)
Maintainer Jeroen Ooms <[email protected]>
Repository CRAN
Date/Publication 2018-05-03 17:34:03 UTC

R topics documented:
jsonld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Index 4

1
2 jsonld

jsonld Working with JSON-LD

Description
Wrappers for converting, expanding and compacting JSON-LD documents. All parameters and re-
turn values must be JSON strings. Use jsonlite::toJSON and jsonlite::fromJSON to convert between
R objects and JSON format. The readme has basic examples.

Usage
jsonld_compact(doc, context, options = NULL)

jsonld_expand(compacted, options = NULL)

jsonld_flatten(doc, context = NULL, options = NULL)

jsonld_frame(doc, frame, options = NULL)

jsonld_from_rdf(rdf, options = list(format = "application/nquads"))

jsonld_to_rdf(doc, options = list(format = "application/nquads"))

jsonld_normalize(doc, options = list(algorithm = "URDNA2015", format =


"application/nquads"))

Arguments
doc a URL or literal string with JSON-LD document
context a URL or literal string with JSON-LD context
options named list with advanced options
compacted a URL or literal string with JSON message
frame a URL or literal string with JSON-LD frame
rdf string with RDF text

Examples
# Example from https://github.com/digitalbazaar/jsonld.js#quick-examples
doc <- '{
"http://schema.org/name": "Manu Sporny",
"http://schema.org/url": {"@id": "http://manu.sporny.org/"},
"http://schema.org/image": {"@id": "http://manu.sporny.org/images/manu.png"}
}'

context <- '{


"name": "http://schema.org/name",
jsonld 3

"homepage": {"@id": "http://schema.org/url", "@type": "@id"},


"image": {"@id": "http://schema.org/image", "@type": "@id"}
}'

# Compact and expand:


(out <- jsonld_compact(doc, context))
(expanded <- jsonld_expand(out))

# Convert between JSON and RDF:


cat(nquads <- jsonld_to_rdf(doc))
jsonld_from_rdf(nquads)

# Other utilities:
jsonld_flatten(doc)
cat(jsonld_normalize(doc))
Index

jsonld, 2
jsonld_compact (jsonld), 2
jsonld_expand (jsonld), 2
jsonld_flatten (jsonld), 2
jsonld_frame (jsonld), 2
jsonld_from_rdf (jsonld), 2
jsonld_normalize (jsonld), 2
jsonld_to_rdf (jsonld), 2
jsonlite::fromJSON, 2
jsonlite::toJSON, 2

You might also like