generated from opengeospatial/bblock-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example for new type of transforms
- Loading branch information
Showing
9 changed files
with
57 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
1 change: 1 addition & 0 deletions
1
_sources/transforms/transforms-example/transforms/prefix-keys.jq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
walk(if type == "object" then with_entries( .key |= "PREF\(.)" ) else . end) |
11 changes: 11 additions & 0 deletions
11
_sources/transforms/transforms-example/transforms/prefix-predicates.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |