knitr::opts_chunk$set( collapse = TRUE, comment = NA, fig.path = "README-" )
The goal of nexld is to serialize NeXML xml data into JSON-LD.
You can install nexld from github with:
# install.packages("devtools") devtools::install_github("cboettig/nexld")
Package is in purely exploratory stage at this time, function api likely to change.
Let's convert a simple NeXML file into JSON-LD:
library(nexld) ex <- system.file("extdata/example.xml", package = "nexld") json <- xml_to_json(ex)
tmp <- tempfile() json_to_xml(json, tmp) nexml_validate(tmp)
Obviously this is just a preliminary mapping to start discussion. The convention is relatively self-explanatory.
edge, otu etc) are replaced by a list of such nodes. meta elements are collapsed into namespaced properties@context is constructed from the xmlns namespacesabout attributes are dropped (as they are redundant to the nesting in JSON-LD). Round trip should restore these. The NeXML standard is only half-semantic, in that metadata (in RDFa-style meta elements) can be serialized to RDF (e.g. via an XSLT stylesheet), but the actual NeXML data cannot.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.