Skip to content

Commit 4771a27

Browse files
Merge pull request #1 from elsevierlabs-os/dev
Added examples, screenshots and better readme
2 parents ac3e8c6 + f37a8c4 commit 4771a27

File tree

7 files changed

+117
-26
lines changed

7 files changed

+117
-26
lines changed

README.md

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,44 @@
11
# Linked Data Extension
22

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.
3+
The Elsevier Data Architecture Linked Data Extension (LDE) for Visual Studio Code brings a number of Linked Data related functionalities to a popular integrated development environment.
44

5-
This extension depends on the [Stardog Languages Extension Pack](https://marketplace.visualstudio.com/items?itemName=stardog-union.vscode-stardog-languages) from Stardog Union
5+
It's not industry-grade solid, but should be *good enough™*. For any questions, comments, please contact [Rinke Hoekstra](mailto:[email protected]), or create an issue in the [GitHub repository](https://github.com/elsevierlabs-os/linked-data).
66

7-
For any questions, comments, please contact [Rinke Hoekstra](mailto:[email protected])
7+
## What it does
88

9-
## Features
9+
* Visualise an RDF graph directly from a file.
10+
* Convert between JSON-LD, Turtle, RDF/XML and N-Quads (some quirks because not every format supports named graphs)
11+
* Convert between JSON-LD variants (compact, expanded, flattened)
12+
* Apply a JSON-LD frame to a JSON-LD file.
13+
* Validate your RDF against a SHACL file
14+
* Run a SPARQL query directly on a file and see the results in HTML and CSV
1015

11-
The extension supports the following:
16+
The JSON-LD operations can work with local context files. This overcomes the limitation in most JSON-LD libraries that interpret context references as URLs. See the `loadLocalContexts` setting below.
17+
18+
Download Linked Data Extension from <https://marketplace.visualstudio.com/items?itemName=Elsevier.linked-data> or through the Extensions menu of VSCode.
19+
20+
This extension depends on the [Stardog Languages Extension Pack](https://marketplace.visualstudio.com/items?itemName=stardog-union.vscode-stardog-languages) from Stardog Union for file type recognition, syntax highlighting and syntax checking.
21+
22+
## Screenshots
23+
24+
For the files used in the screenshots, see the [examples](examples) folder.
25+
26+
### Conversion Between RDF Formats
27+
28+
![RDF Formats](media/img/different_formats.png)
29+
30+
### Visualisation and JSON-LD Variants
31+
32+
![Visualization](media/img/jsonld_visualisation.png)
33+
34+
### SPARQL and SHAQL
35+
![Querying and Validation](media/img/shacl_and_sparql.png)
36+
37+
## Commands
38+
39+
You can access the commands through the command palette: `Cmd-Shift-p` or `Ctrl-Shift-p` and then start typing "Linked Data", or use one of the following keyboard shortcuts.
40+
41+
### Keyboard Shortcuts
1242

1343
* Standard syntactic JSON-LD operations:
1444
* `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)
@@ -27,27 +57,11 @@ The extension supports the following:
2757
* Query a Graph:
2858
* `Ctrl-Option-q`/`Ctrl-Alt-q`: Run the SPARQL query against an RDF file (see below)
2959

30-
You can also access the commands through the command palette: `Cmd-Shift-p` or `Ctrl-Shift-p` and then start typing "Linked Data".
31-
32-
<!-- ## Screenshots
33-
34-
### Conversion Between RDF Formats
35-
36-
![RDF Formats](media/img/different_formats.png)
37-
38-
### Visualisation and JSON-LD Variants
39-
40-
![Visualization](media/img/jsonld_visualisation.png)
41-
42-
### SPARQL and SHAQL
43-
![Querying and Validation](media/img/shacl_and_sparql.png) -->
44-
45-
4660
## Extension Settings
4761

4862
This extension contributes the following settings:
4963

50-
* `linked-data.loadLocalContexts`: Should the extension try to load local (non-URI) contexts?
64+
* `linked-data.loadLocalContexts`: Should the extension try to load local (non-URI) JSON-LD context files. This is especially useful when testing large context files that are intended to be shared across multiple JSON-LD files. It overcomes the problem that JSON-LD libraries interpret references to contexts as URIs, which would require running an HTTP server to test the context.
5165

5266
## Tips and Recommendations
5367

@@ -91,7 +105,4 @@ SPARQL results are shown both as a web view with a table that supports sorting a
91105
* Zazuko's SHACL validator, <https://github.com/zazuko/rdf-validate-shacl>
92106
* Google's Schemarama, <https://github.com/google/schemarama>
93107
* d3js, <https://d3js.org>
94-
95-
## Release Notes
96-
97-
- v1.0.0 - Open Source Release
108+
* ... and many others.

examples/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The examples in this folder are:
2+
3+
* [`shacl_example.ttl`](shacl_example.ttl) is a sample Turtle file for testing SHACL constraints.
4+
* [`shacl_example_shapes.ttl`](shacl_example_shapes.ttl) holds SHACL constraints for validating [`shacl_example.ttl`](shacl_example.ttl). Note that the [`shacl_example.ttl`](shacl_example.ttl) file refers to this shapes file. This is not required, but avoids having to select the shapes file from a file open window.
5+
* [`shacl_example.rq`](shacl_example.rq) is a very simple SPARQL query to query the [`shacl_example.ttl`](shacl_example.ttl) file. Note that the SPARQL query refers to the file it is intended to query. This is not required, but avoids having to select the data file from a file open window.
6+
* [`test.jsonld`](test.jsonld) is an example JSON-LD file that can be used for testing format conversion and JSON-LD manipulation.
7+
* [`test_frame.jsonld`](test_frame.jsonld) is an example JSON-LD frame for framing the [`test.jsonld`](test.jsonld) file.

examples/shacl_example.rq

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# file: shacl_example.ttl
2+
SELECT * WHERE {
3+
?a ?b ?c .
4+
}

examples/shacl_example.ttl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# shapes: shacl_example_shapes.ttl
2+
@prefix ex: <https://example.com/> .
3+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4+
5+
ex:Alice
6+
a ex:Person ;
7+
ex:ssn "987-65-432A" .
8+
9+
ex:Bob
10+
a ex:Person ;
11+
ex:ssn "123-45-6789x" ;
12+
ex:ssn "124-35-6789" .
13+
14+
ex:Calvin
15+
a ex:Person ;
16+
ex:birthDate "1971-07-07"^^xsd:date ;
17+
ex:worksFor ex:UntypedCompany .

examples/shacl_example_shapes.ttl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@prefix ex: <https://example.com/> .
2+
@prefix sh: <http://www.w3.org/ns/shacl#> .
3+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
5+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
6+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
7+
8+
ex:Person a owl:Class .
9+
10+
ex:PersonShape
11+
rdfs:label "PersonTest";
12+
a sh:NodeShape ;
13+
sh:targetClass ex:Person ; # Applies to all persons
14+
sh:property [ # _:b1
15+
sh:path ex:ssn ; # constrains the values of ex:ssn
16+
sh:maxCount 1 ;
17+
sh:datatype xsd:string ;
18+
sh:pattern "^\\d{3}-\\d{2}-\\d{4}$" ;
19+
] .

examples/test.jsonld

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"@context": {
3+
"@vocab": "https://example.com/a/",
4+
"@base": "https://example.com/b/",
5+
"myns": "https://example.com/a/",
6+
"otherns": "https://example.com/b/",
7+
"owl": "http://www.w3.org/2002/07/owl#"
8+
},
9+
"@graph": [{
10+
"@id": "b123",
11+
"@type": "Fish",
12+
"name": "What a nice name",
13+
"linkedTo": {
14+
"@id": "b456",
15+
"name": "That's a silly name",
16+
"@type": "Squid",
17+
"linkedTo": {
18+
"name": "No names are cool"
19+
}
20+
}},
21+
{"@id": "myns:Fish", "@type": "owl:Class"}
22+
]
23+
}

examples/test_frame.jsonld

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"@context": {
3+
"@vocab": "https://example.com/a/",
4+
"@base": "https://example.com/b/",
5+
"myns": "https://example.com/a/",
6+
"otherns": "https://example.com/b/",
7+
"owl": "http://www.w3.org/2002/07/owl#"
8+
},
9+
"@type": "myns:Fish"
10+
}

0 commit comments

Comments
 (0)