Commit d6371482 authored by Maxime Lefrançois's avatar Maxime Lefrançois

example documentation

parent 82457858
PREFIX st: <http://ns.inria.fr/sparql-template/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dctype: <http://purl.org/dc/dcmitype/>
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX fun: <http://w3id.org/sparql-generate/fn/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
BASE <https://saref.etsi.org/documentation/>
TEMPLATE <example/description.rqg>( ?example ) {
COALESCE(
IF( st:call-template( <function/formatText.rqg>, ?description_en ) != "" , st:call-template( <function/formatText.rqg>, ?description_en ) , ?undef ),
IF( st:call-template( <function/formatText.rqg>, ?description ) != "" , st:call-template( <function/formatText.rqg>, ?description ) , ?undef ),
"Violation of TS 103 673 Clause 9.6.3: no description" )
}
WHERE {
OPTIONAL {
?example dcterms:description ?description_en .
FILTER (LANG(?description_en)="en")
}
OPTIONAL {
?example dcterms:description ?description .
FILTER ( DATATYPE(?description) = xsd:string )
}
}
LIMIT 1
\ No newline at end of file
......@@ -2,29 +2,56 @@ PREFIX st: <http://ns.inria.fr/sparql-template/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dctype: <http://purl.org/dc/dcmitype/>
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX fun: <http://w3id.org/sparql-generate/fn/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
BASE <https://saref.etsi.org/documentation/>
TEMPLATE <example/main.rqg>( ?example ) {
TEMPLATE <header.rqg>( TEMPLATE <term/label.rqg>( ?example ) . , ?pathToStatic , false ).
TEMPLATE <header.rqg>( st:call-template(<term/label.rqg>, ?example ) , ?pathToStatic , false ).
"""
<header id="g-header">
This is an example { ?example }
<div class="g-container">
<div class="g-block size-100">
<div class="g-content g-particle">
<h1><a href="{?example}">{ TEMPLATE <example/title.rqg>( ?example ) . }</a></h1>
<p>{ TEMPLATE <example/description.rqg>( ?example ) . }</p>
<dl>
<dt>IRI:</dt><dd><a href='{?example}'>{?example}</a></dd>
{
TEMPLATE {
before = "<dt>Conforms to:</dt><dd>";
"""<a href="{?other}">{?other}</a>"""
; separator = "<br/>" ; after="</dd>" }
WHERE { ?term dcterms:conformsTo ?other }
ORDER BY DESC( ?other ) .
}
<dt>Download serialization:</dt><dd>
<span><a href="{ ?name }.jsonld" target="_blank"><img src="https://img.shields.io/badge/Format-JSON--LD-blue.svg"/></a></span>
<span><a href="{ ?name }.n3" target="_blank"><img src="https://img.shields.io/badge/Format-N3-blue.svg"/></a></span>
<span><a href="{ ?name }.nt" target="_blank"><img src="https://img.shields.io/badge/Format-N--Triples-blue.svg"/></a></span>
<span><a href="{ ?name }.n3" target="_blank"><img src="https://img.shields.io/badge/Format-N_Triples-blue.svg"/></a></span>
<span><a href="{ ?name }.rdf" target="_blank"><img src="https://img.shields.io/badge/Format-RDF/XML-blue.svg"/></a></span>
<span><a href="{ ?name }.ttl" target="_blank"><img src="https://img.shields.io/badge/Format-Turtle-blue.svg"/></a></span>
</dd>
<dt>License:</dt><dd>
<span><a href="https://forge.etsi.org/etsi-software-license" target="_blank"><img src="https://img.shields.io/badge/License-https://forge.etsi.org/etsi--software--license-blue.svg"/></a></span>
</dd>
</dl>
</div>
</div>
</div>
</header>
"""
TEMPLATE {
?s " " ?p " " ?o " ."
; separator = "\n"
} WHERE {
?s ?p ?o .
} .
TEMPLATE <footer.rqg>( ?pathToStatic , false ) .
......@@ -32,6 +59,17 @@ TEMPLATE <footer.rqg>( ?pathToStatic , false ) .
FROM ?example
WHERE {
BIND( fun:regex( str(?example), "^https://saref.etsi.org/([a-z4]+)/(v[0-9]+\\.[0-9]+\\.[0-9]+)/example/([^#]+)#$", 1 ) AS ?path )
BIND( fun:regex( str(?example), "^https://saref.etsi.org/([a-z4]+)/(v[0-9]+\\.[0-9]+\\.[0-9]+)/example/([^#]+)#$", 2 ) AS ?versionInfo )
BIND( fun:regex( str(?example), "^https://saref.etsi.org/([a-z4]+)/(v[0-9]+\\.[0-9]+\\.[0-9]+)/example/([^#]+)#$", 3 ) AS ?name )
BIND( IF( ?path = "core" , "SAREF" , "SAREF{UCASE(SUBSTR(?path,6))}" ) AS ?project )
BIND( IF( ?path = "core" , "saref:" , "s{SUBSTR(?path,6)}:" ) AS ?prefix )
BIND( IRI( fun:regex( str(?example), "^(https://saref.etsi.org/[a-z4]+/v[0-9]+\\.[0-9]+\\.[0-9]+/)example/[^#]+#$", 1 ) ) AS ?onto )
?example a dctype:Dataset
BIND( "../../../static" AS ?pathToStatic )
}
......
PREFIX st: <http://ns.inria.fr/sparql-template/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dctype: <http://purl.org/dc/dcmitype/>
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX fun: <http://w3id.org/sparql-generate/fn/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
BASE <https://saref.etsi.org/documentation/>
TEMPLATE <example/title.rqg>( ?example ) {
COALESCE(
IF( st:call-template( <function/formatText.rqg>, ?description_en ) != "" , st:call-template( <function/formatText.rqg>, ?description_en ) , ?undef ),
IF( st:call-template( <function/formatText.rqg>, ?description ) != "" , st:call-template( <function/formatText.rqg>, ?description ) , ?undef ),
"Violation of TS 103 673 Clause 9.6.3: no title" )
}
WHERE {
OPTIONAL {
?example dcterms:title ?description_en .
FILTER (LANG(?description_en)="en")
}
OPTIONAL {
?example dcterms:title ?description .
FILTER ( DATATYPE(?description) = xsd:string )
}
}
LIMIT 1
\ No newline at end of file
......@@ -72,7 +72,17 @@ TEMPLATE <header.rqg>( st:call-template(<ontology/title.rqg>, ?onto ) , ?pathToS
<dt>Prefix and namespace declaration:<dt>
<dd>Turtle: <code>@prefix {?prefix} &lt;{?onto}&gt; .</code><dd>
<dd>SPARQL: <code>PREFIX {?prefix} &lt;{?onto}&gt;</code><dd>
<dt>License</dt><dd><a href='https://forge.etsi.org/etsi-software-license'>https://forge.etsi.org/etsi-software-license</a></dd>
<dt>Download serialization:</dt><dd>
<span><a href="{ ?filename }.jsonld" target="_blank"><img src="https://img.shields.io/badge/Format-JSON--LD-blue.svg"/></a></span>
<span><a href="{ ?filename }.n3" target="_blank"><img src="https://img.shields.io/badge/Format-N3-blue.svg"/></a></span>
<span><a href="{ ?filename }.nt" target="_blank"><img src="https://img.shields.io/badge/Format-N--Triples-blue.svg"/></a></span>
<span><a href="{ ?filename }.n3" target="_blank"><img src="https://img.shields.io/badge/Format-N_Triples-blue.svg"/></a></span>
<span><a href="{ ?filename }.rdf" target="_blank"><img src="https://img.shields.io/badge/Format-RDF/XML-blue.svg"/></a></span>
<span><a href="{ ?filename }.ttl" target="_blank"><img src="https://img.shields.io/badge/Format-Turtle-blue.svg"/></a></span>
</dd>
<dt>License:</dt><dd>
<span><a href="https://forge.etsi.org/etsi-software-license" target="_blank"><img src="https://img.shields.io/badge/License-https://forge.etsi.org/etsi--software--license-blue.svg"/></a></span>
</dd>
</dl>
</div>
</div>
......@@ -258,6 +268,7 @@ WHERE {
} FROM ?versionIRI
WHERE {
BIND( fun:regex( str(?versionIRI), "^https://saref.etsi.org/([a-z4]+)/([^/]+)/$", 1 ) AS ?ext )
BIND( IF( ?ext = "core" , "saref" , ?ext ) AS ?filename )
BIND( IF( ?ext = "core" , "saref" , "s{SUBSTR(?ext,6)}" ) AS ?short )
BIND( UCASE( ?short ) AS ?name )
BIND( "{?short}:" AS ?prefix )
......
......@@ -39,7 +39,18 @@ TEMPLATE <term/main.rqg>( ?term ) {
WHERE { ?term ex:isUsedBy ?onto }
ORDER BY DESC( ?onto ) .
}
</dl>
<dt>Download serialization:</dt><dd>
<span><a href="{ ?localName }.jsonld" target="_blank"><img src="https://img.shields.io/badge/Format-JSON--LD-blue.svg"/></a></span>
<span><a href="{ ?localName }.n3" target="_blank"><img src="https://img.shields.io/badge/Format-N3-blue.svg"/></a></span>
<span><a href="{ ?localName }.nt" target="_blank"><img src="https://img.shields.io/badge/Format-N--Triples-blue.svg"/></a></span>
<span><a href="{ ?localName }.n3" target="_blank"><img src="https://img.shields.io/badge/Format-N_Triples-blue.svg"/></a></span>
<span><a href="{ ?localName }.rdf" target="_blank"><img src="https://img.shields.io/badge/Format-RDF/XML-blue.svg"/></a></span>
<span><a href="{ ?localName }.ttl" target="_blank"><img src="https://img.shields.io/badge/Format-Turtle-blue.svg"/></a></span>
</dd>
<dt>License:</dt><dd>
<span><a href="https://forge.etsi.org/etsi-software-license" target="_blank"><img src="https://img.shields.io/badge/License-https://forge.etsi.org/etsi--software--license-blue.svg"/></a></span>
</dd>
</dl>
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment