|
| 1 | +# Linked Data Extension |
| 2 | + |
| 3 | +The Elsevier Data Architecture Linked Data Extension for Visual Studio Code brings a number of Linked Data related functionalities to a popular integrated development environment. |
| 4 | + |
| 5 | +This extension depends on the [Stardog Languages Extension Pack](https://marketplace.visualstudio.com/items?itemName=stardog-union.vscode-stardog-languages) from Stardog Union |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +The extension supports the following: |
| 10 | + |
| 11 | +* Standard syntactic JSON-LD operations: |
| 12 | + * `Ctrl-Option-e`/`Ctrl-Alt-e`: Convert a JSON-LD structure to the [expanded document form](https://www.w3.org/TR/json-ld11/#expanded-document-form) |
| 13 | + * `Ctrl-Option-c`/`Ctrl-Alt-c`: Apply `@context` specifications to convert a JSON-LD structure to the [compacted document form](https://www.w3.org/TR/json-ld11/#compacted-document-form). Only works with an included context (not external files) |
| 14 | + * `Ctrl-Option-l`/`Ctrl-Alt-l`: Convert a JSON-LD structure to the [flattened document form](https://www.w3.org/TR/json-ld11/#flattened-document-form) |
| 15 | + * `Ctrl-Option-f`/`Ctrl-Alt-f`: Apply a JSON-LD frame file to convert a JSON-LD structure to the [framed document form](https://www.w3.org/TR/json-ld11/#framed-document-form) using the [framing algorithm](https://www.w3.org/TR/json-ld11-framing/). |
| 16 | +* Standard format conversions: |
| 17 | + * `Ctrl-Option-n`/`Ctrl-Alt-n`: Convert an RDF file (any format) to N-Quads |
| 18 | + * `Ctrl-Option-t`/`Ctrl-Alt-t`: Convert an RDF file (any format) to Turtle (may be lossy for files that contain multiple graphs) |
| 19 | + * `Ctrl-Option-r`/`Ctrl-Alt-r`: Convert an RDF file (any format) to RDF/XML (may be lossy for files that contain multiple graphs) |
| 20 | + * `Ctrl-Option-j`/`Ctrl-Alt-j`: Convert an RDF file (any format) to JSON-LD |
| 21 | +* View as a Graph: |
| 22 | + * `Ctrl-Option-g`/`Ctrl-Alt-g`: Render an RDF file as a D3js force directed graph. |
| 23 | +* Validate against SHACL shapes: |
| 24 | + * `Ctrl-Option-v`/`Ctrl-Alt-v`: Validate an RDF file against SHACL shapes (see below) |
| 25 | +* Query a Graph: |
| 26 | + * `Ctrl-Option-q`/`Ctrl-Alt-q`: Run the SPARQL query against an RDF file (see below) |
| 27 | + |
| 28 | +You can also access the commands through the command palette: `Cmd-Shift-p` or `Ctrl-Shift-p` and then start typing "Linked Data". |
| 29 | + |
| 30 | +## Screenshots |
| 31 | + |
| 32 | +### Conversion Between RDF Formats |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +### Visualisation and JSON-LD Variants |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +### SPARQL and SHAQL |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +## Extension Settings |
| 45 | + |
| 46 | +This extension contributes the following settings: |
| 47 | + |
| 48 | +* `linked-data.loadLocalContexts`: Should the extension try to load local (non-URI) contexts? |
| 49 | + |
| 50 | +## Tips and Recommendations |
| 51 | + |
| 52 | +### SHACL Validator |
| 53 | +The SHACL Validator can be told what shapes file to use, by adding commented lines to the top of a Turtle file (does not work for JSON-LD) that refer to a (relative path) to the shapes file using the `shapes` attribute, e.g. the following will try to load the `my_excellent_shapes.ttl` file. |
| 54 | + |
| 55 | +``` |
| 56 | +# shapes: my_excellent_shapes.ttl |
| 57 | +@prefix ex: <https://example.com/> . |
| 58 | +
|
| 59 | +ex:Alice |
| 60 | + a ex:Person ; |
| 61 | + ex:ssn "987-65-432A" . |
| 62 | +``` |
| 63 | + |
| 64 | +If there is no such instruction, or the instruction cannot be parsed as YAML, the extension will show a file open window for you to select the shapes file to use. |
| 65 | + |
| 66 | + |
| 67 | +### SPARQL Query |
| 68 | +You can run a SPARQL Query only from valid SPARQL files (`*.rq`), and similar to the SHACL validator, you can specify the file against which you want to run the query by using the `file` attribute: |
| 69 | + |
| 70 | +``` |
| 71 | +# file: example-1-transformed/source.json |
| 72 | +SELECT * WHERE { |
| 73 | + ?a ?b ?c . |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +If there is no such instruction, or the instruction cannot be parsed as YAMLM, the extension will show a file open window for you to select the RDF file to query against. |
| 78 | + |
| 79 | +SPARQL results are shown both as a web view with a table that supports sorting and search, as well as a CSV file for further processing. |
| 80 | + |
| 81 | +## Known Limitations |
| 82 | + |
| 83 | +* RDF format support is limited to the underlying libraries. E.g RDF/XML support is spotty as it doesn't deal with XML entity definitions very well. |
| 84 | + |
| 85 | +## Thanks go to: |
| 86 | + |
| 87 | +* Stardog VSCode Extensions, <https://github.com/stardog-union/stardog-vsc> |
| 88 | +* rdflib.js, <https://github.com/linkeddata/rdflib.js/> |
| 89 | +* Zazuko's SHACL validator, <https://github.com/zazuko/rdf-validate-shacl> |
| 90 | +* Google's Schemarama, <https://github.com/google/schemarama> |
| 91 | +* d3js, <https://d3js.org> |
| 92 | + |
| 93 | +## Release Notes |
| 94 | + |
| 95 | +- v1.0.0 - Open Source Release |
0 commit comments