Skip to content

Commit 14dd1c3

Browse files
committed
Open source version of Linked Data extension
0 parents  commit 14dd1c3

20 files changed

+10787
-0
lines changed

.eslintrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"ecmaVersion": 6,
6+
"sourceType": "module"
7+
},
8+
"plugins": [
9+
"@typescript-eslint"
10+
],
11+
"rules": {
12+
"@typescript-eslint/naming-convention": "warn",
13+
"@typescript-eslint/semi": "warn",
14+
"curly": "warn",
15+
"eqeqeq": "warn",
16+
"no-throw-literal": "warn",
17+
"semi": "off"
18+
},
19+
"ignorePatterns": [
20+
"out",
21+
"dist",
22+
"**/*.d.ts"
23+
]
24+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
*/node_modules
3+
out
4+
*.vsix
5+
.DS_Store

.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [{
8+
"name": "Run Extension",
9+
"type": "extensionHost",
10+
"request": "launch",
11+
"runtimeExecutable": "${execPath}",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}"
14+
],
15+
"outFiles": [
16+
"${workspaceFolder}/out/**/*.js"
17+
],
18+
"preLaunchTask": "npm: watch"
19+
}
20+
]
21+
}

.vscode/tasks.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "watch",
9+
"problemMatcher": "$tsc-watch",
10+
"isBackground": true,
11+
"presentation": {
12+
"reveal": "never"
13+
},
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
}
19+
]
20+
}

.vscodeignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.vscode/**
2+
.vscode-test/**
3+
out/test/**
4+
src/**
5+
.gitignore
6+
.yarnrc
7+
vsc-extension-quickstart.md
8+
**/tsconfig.json
9+
**/.eslintrc.json
10+
**/*.map
11+
**/*.ts

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Change Log
2+
3+
All notable changes to the "json-ld-viewer" extension will be documented in this file.
4+
5+
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6+
7+
## [Unreleased]
8+
9+
- v0.0.1: Initial release
10+
- v0.0.2: Bugfix
11+
- Fixed an issue with dependencies.
12+
- v0.0.3: Features
13+
- Added keyboard shortcuts
14+
- Improved readme
15+
- v0.0.4: Added EDM code completion
16+
- v0.0.5: Improved EDM code completion
17+
- Better dealing of arrays and optional values
18+
- Better handling of inheritance
19+
- v0.0.6: Bugfix in EDM schema
20+
- v0.0.7: Significantly reduced size of EDM and RV schemas

LICENSE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2019-2022 Elsevier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+
![RDF Formats](img/different_formats.png)
35+
36+
### Visualisation and JSON-LD Variants
37+
38+
![Visualization](img/jsonld_visualisation.png)
39+
40+
### SPARQL and SHAQL
41+
![Querying and Validation](img/shacl_and_sparql.png)
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

img/different_formats.png

581 KB
Loading

img/jsonld_visualisation.png

532 KB
Loading

0 commit comments

Comments
 (0)