Skip to content

Commit

Permalink
Add example for new type of transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Oct 3, 2024
1 parent 0a1c224 commit ffde692
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 32 deletions.
13 changes: 1 addition & 12 deletions _sources/feature/geojsonFeature/examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,4 @@
base-uri: http://example.com/features/
snippets:
- language: json
ref: examples/feature.json

transforms:
- input-language: application/json
output-language: application/json
type: jq
code: '.properties.myPropUpper = (.properties.myProp | ascii_upcase)'

- input-language: text/turtle
output-language: text/turtle
type: shacl
ref: transforms/sample.shacl
ref: examples/feature.json
20 changes: 0 additions & 20 deletions _sources/feature/geojsonFeature/transforms/sample.shacl

This file was deleted.

8 changes: 8 additions & 0 deletions _sources/transforms/transforms-example/bblock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Transforms example",
"status": "under-development",
"dateTimeAddition": "2024-10-03T11:31:00+02:00",
"itemClass": "schema",
"version": "0.1",
"dateOfLastChange": "2024-10-03"
}
8 changes: 8 additions & 0 deletions _sources/transforms/transforms-example/context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"@context": {
"ex": "http://example.com/",
"one": "ex:hasOne",
"two": "ex:hasTwo",
"string": "ex:hasString",
}
}
10 changes: 10 additions & 0 deletions _sources/transforms/transforms-example/examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
examples:
- title: Example for transforms
snippets:
- language: json
code: |
{
"one": 1,
"two": 2,
"string": "value"
}
8 changes: 8 additions & 0 deletions _sources/transforms/transforms-example/schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: object
properties:
one:
type: number
two:
type: number
string:
type: string
10 changes: 10 additions & 0 deletions _sources/transforms/transforms-example/transforms.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
transforms:
- id: prefix-keys
description: Adds a "PREF" prefix to all object keys.
type: jq
ref: transforms/prefix-keys.jq

- id: prefix-predicates
description: Changes the "http://example.com/" prefix of every predicate to a URN
type: sparql-update
ref: transforms/prefix-predicates.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
walk(if type == "object" then with_entries( .key |= "PREF\(.)" ) else . end)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DELETE {
?s ?p ?o
}
INSERT {
?s ?p2 ?o
}
WHERE {
?s ?p ?o
FILTER(STRSTARTS(STR(?p), "http://example.com/"))
BIND(URI(REPLACE(STR(?p), "^http://example.com/", "urn:example:ex#")) as ?p2)
}

0 comments on commit ffde692

Please sign in to comment.