Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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 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/>
TEMPLATE <term/main.rqg>( ?term ) {
TEMPLATE <header.rqg>(?before, ?pathToStatic , false ).
"""
<header id="g-header">
<div class="g-container">
<div class="g-block size-100">
<div class="g-content g-particle">
<h1><a href="{?term}">{?prefix}{?localName}</a> ({ TEMPLATE { ?label } WHERE { ?term rdfs:label ?label } . })</h1>
<p><em>Defined in <a href="{?ontoRef}">{?ontoRef}</a> as: </em></p>
<p>{ TEMPLATE { ?description } WHERE { ?term rdfs:comment ?description } . }</p>
<dl>
<dt>IRI:</dt><dd><a href='{?term}'>{?term}</a></dd>
{
TEMPLATE {
before = "<dt>Is defined by:</dt><dd>";
"""<a href="{?onto}">{?onto}</a>"""
; separator = "<br/>" ; after="</dd>" }
WHERE { ?term rdfs:isDefinedBy ?onto }
ORDER BY DESC( ?onto ) .
}</dd>
{
TEMPLATE {
before = "<dt>Is used by:</dt><dd>";
"""<a href="{?onto}">{?onto}</a>"""
; separator="<br/>" ; after="</dd>" }
WHERE { ?term ex:isUsedBy ?onto }
ORDER BY DESC( ?onto ) .
}
</dl>
</div>
</div>
</div>
</header>
<section>
<div class="g-container">
<div class="g-content">
{ TEMPLATE{ TEMPLATE <term/class.rqg>( ?term ) . }
FROM ?ontoRef
WHERE { ?term a owl:Class } .
}
{ TEMPLATE{ TEMPLATE <term/objectProperty.rqg>( ?term ) . }
FROM ?ontoRef
WHERE { ?term a owl:ObjectProperty } .
}
{ TEMPLATE{ TEMPLATE <term/dataProperty.rqg>( ?term ) . }
FROM ?ontoRef
WHERE { ?term a owl:DatatypeProperty } .
}
{ TEMPLATE{ TEMPLATE <term/individual.rqg>( ?term ) . }
FROM ?ontoRef
WHERE { ?term a owl:NamedIndividual } .
}
</div>
</div>
</section>
"""
TEMPLATE <footer.rqg>( ?pathToStatic , false ) .
}
FROM ?term
WHERE {
BIND( fun:regex( str(?term), "^https://saref.etsi.org/([a-z4]+)/([^/]+)$", 1 ) AS ?ext )
BIND( IF( ?ext = "core" , "saref:" , "s{SUBSTR(?ext,6)}:" ) AS ?prefix )
BIND( fun:regex( str(?term), "^https://saref.etsi.org/([a-z4]+)/([^/]+)$", 2 ) AS ?localName )
BIND( fun:regex( str(?term), "^(https://saref.etsi.org/[a-z4]+/)[^/]+$", 1 ) AS ?namespace )
BIND( "../static" AS ?static )
?term rdfs:label ?title ;
rdfs:isDefinedBy ?ontoRef
BIND(REPLACE(?title, "[\n|\r|\r\n].*", "") AS ?before )
BIND( "../static" AS ?pathToStatic )
}
ORDER BY DESC( ?ontoRef )
LIMIT 1