Skip to content

Instantly share code, notes, and snippets.

@ericprud
Last active September 29, 2022 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericprud/280675952ab8e7708a35aa33cfcac5f8 to your computer and use it in GitHub Desktop.
Save ericprud/280675952ab8e7708a35aa33cfcac5f8 to your computer and use it in GitHub Desktop.
# https://shex.io/webapps/packages/extension-map/doc/shexmap-simple?manifestURL=https://gist.githubusercontent.com/ericprud/280675952ab8e7708a35aa33cfcac5f8/raw/907687f15dfa0035672c093255400ab573fb8b83/ldtvm.yaml
---
- schemaLabel: Reducing FOAF to RDFS
schema: |
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX Map: <http://shex.io/extensions/Map/#>
PREFIX x: <http://idunno.example/bindings#>
</DocumentShape> {
a [foaf:Document] ;
dc:title LITERAL %Map:{ x:title %}
}
dataLabel: instance
data: |
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/terms/>
</mydoc> a foaf:Document ;
dc:title "A" .
queryMap: "</mydoc>@</DocumentShape>"
outputSchema: |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX Map: <http://shex.io/extensions/Map/#>
PREFIX x: <http://idunno.example/bindings#>
</ResourceShape> {
a [rdfs:Resource] ;
rdfs:label LITERAL %Map:{ x:title %}
}
outputShape: "</ResourceShape>"
staticVars:
http://abc.example/someConstant: '"123-456"'
createRoot: "<http://idunno.example>"
status: conformant
- schemaLabel: Structured Values and Shorthand Properties
schema: |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
PREFIX Map: <http://shex.io/extensions/Map/#>
PREFIX x: <http://idunno.example/bindings#>
</identifiedByShape> {
bf:identifiedBy {
a [bf:Isbn] ;
rdf:value LITERAL %Map:{ x:isbn %}
}
}
dataLabel: instance
data: |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
</instance/a>
bf:identifiedBy [ a bf:Isbn ; rdf:value "12-3456-789-0" ] .
queryMap: "</instance/a>@</identifiedByShape>"
outputSchema: |
prefix schema: <http://schema.org/>
PREFIX Map: <http://shex.io/extensions/Map/#>
PREFIX x: <http://idunno.example/bindings#>
</isbnShape> {
schema:isbn LITERAL %Map:{ x:isbn %}
}
outputShape: "</isbnShape>"
staticVars:
http://abc.example/someConstant: '"123-456"'
createRoot: "<http://idunno.example>"
status: conformant
- schemaLabel: Qualified Relations as Reifications
schema: |
PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
PREFIX lcrel: <http://id.loc.gov/vocabulary/relators/>
PREFIX Map: <http://shex.io/extensions/Map/#>
PREFIX x: <http://idunno.example/bindings#>
</workShape> {
bf:contribution {
bf:agent IRI %Map:{ x:contrib %} ;
bf:role [lcrel:ill]
}
}
dataLabel: instance
data: |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
PREFIX lcrel: <http://id.loc.gov/vocabulary/relators/>
</work>
bf:contribution [
bf:agent </person/a> ;
bf:role lcrel:ill
] .
queryMap: "</work>@</workShape>"
outputSchema: |
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX Map: <http://shex.io/extensions/Map/#>
PREFIX x: <http://idunno.example/bindings#>
</workShape2> {
dc:contributor IRI %Map:{ x:contrib %}
}
outputShape: "</workShape2>"
staticVars:
http://abc.example/someConstant: '"123-456"'
createRoot: "<http://idunno.example>"
status: conformant
- schemaLabel: Reification and Events
schema: |
PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
PREFIX Map: <http://shex.io/extensions/Map/#>
PREFIX x: <http://idunno.example/bindings#>
</BfShape> {
bf:provisionActivity {
a [bf:Publication] ;
bf:agent IRI %Map:{ x:contrib %} ;
bf:date LITERAL %Map:{ x:when %}
}
}
dataLabel: provision
data: |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
</instance/a>
bf:provisionActivity [
a bf:Publication ;
bf:agent </org/a> ;
bf:date "2017"
] .
queryMap: "</instance/a>@</BfShape>"
outputSchema: |
PREFIX schema: <http://schema.org/>
PREFIX Map: <http://shex.io/extensions/Map/#>
PREFIX x: <http://idunno.example/bindings#>
</SchemaShape> {
schema:publisher IRI %Map:{ x:contrib %};
schema:datePublished LITERAL %Map:{ x:when %}
}
outputShape: "</SchemaShape>"
staticVars:
http://abc.example/someConstant: '"123-456"'
createRoot: "<http://idunno.example>"
status: conformant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment