Skip to content

Commit 7c54ec3

Browse files
committed
Added examples
1 parent ac3e8c6 commit 7c54ec3

File tree

6 files changed

+80
-0
lines changed

6 files changed

+80
-0
lines changed

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)