Commit 748e7c1c authored by Maxime Lefrançois's avatar Maxime Lefrançois
Browse files

updated some conditions

parent ce30ef66
......@@ -39,10 +39,14 @@ public class CMDConfigurations {
public static final String ARG_IGNORE_EXAMPLES = "e";
public static final String ARG_IGNORE_EXAMPLES_LONG = "ignore-examples";
public static final String ARG_IGNORE_EXAMPLES_MAN = "Only check the SAREF extension ontology. Ignore the examples.";
public static final String ARG_NO_SITE = "s";
public static final String ARG_NO_SITE_LONG = "no-site";
public static final String ARG_NO_SITE_MAN = "Do not generate the static website";
public static final String ARG_IGNORE_TERMS = "t";
public static final String ARG_IGNORE_TERMS_LONG = "no-terms";
public static final String ARG_IGNORE_TERMS_MAN = "Do not generate the website for terms";
public static final String ARG_INCLUDE_MASTER = "m";
public static final String ARG_INCLUDE_MASTER_LONG = "master";
......@@ -66,6 +70,7 @@ public class CMDConfigurations {
.addOption(ARG_IGNORE_EXAMPLES, ARG_IGNORE_EXAMPLES_LONG, false, ARG_IGNORE_EXAMPLES_MAN)
.addOption(ARG_IGNORE_GIT, ARG_IGNORE_GIT_LONG, false, ARG_IGNORE_GIT_MAN)
.addOption(ARG_NO_SITE, ARG_NO_SITE_LONG, false, ARG_NO_SITE_MAN)
.addOption(ARG_IGNORE_TERMS, ARG_IGNORE_TERMS_LONG, false, ARG_INCLUDE_MASTER_MAN)
.addOption(ARG_INCLUDE_MASTER, ARG_INCLUDE_MASTER_LONG, false, ARG_INCLUDE_MASTER_MAN)
.addOption(ARG_VERBOSE, ARG_VERBOSE_LONG, false, ARG_VERBOSE_MAN);
}
......
......@@ -102,6 +102,7 @@ public class Main {
static boolean ignoreGit;
static boolean includeMaster;
static boolean generateSite;
static boolean ignoreTerms;
static boolean ignoreExamples;
static boolean verbose;
......@@ -124,6 +125,7 @@ public class Main {
includeMaster = cl.hasOption(ARG_INCLUDE_MASTER);
generateSite = !cl.hasOption(ARG_NO_SITE);
ignoreExamples = cl.hasOption(ARG_IGNORE_EXAMPLES);
ignoreTerms = cl.hasOption(ARG_IGNORE_TERMS);
verbose = cl.hasOption(ARG_VERBOSE);
setLogAppenders();
......@@ -154,7 +156,7 @@ public class Main {
new CheckConfig().doJob(dataset, ignoreExamples);
if (generateSite) {
new GeneratePortal("Generate static files for the portal", streamManager).doJob(dataset, directory, verbose);
new GeneratePortal("Generate static files for the portal", streamManager).doJob(dataset, directory, verbose, ignoreExamples, ignoreTerms);
}
......
......@@ -70,7 +70,7 @@ public class GeneratePortal extends JobRunner {
}
public void doJob(Dataset dataset, File directory, boolean verbose) {
public void doJob(Dataset dataset, File directory, boolean verbose, boolean ignoreExamples, boolean ignoreTerms) {
File siteDir = new File(directory, Constants.SITE_DIR);
dataset.begin(ReadWrite.READ);
Model config = dataset.getNamedModel(Constants.CONFIG);
......@@ -110,57 +110,61 @@ public class GeneratePortal extends JobRunner {
}
}
for (ResIterator it = config.listResourcesWithProperty(RDF.type, RDFP.Resource); it.hasNext();) {
Resource resource = it.next();// https://saref.etsi.org/core/master/ -- https://saref.etsi.org/core/Command
String uri = resource.getURI();
try {
String termPath = uri.substring(Constants.BASE.length()); // core/Command
File termDir = new File(siteDir, termPath).getParentFile(); // core
FileUtils.forceMkdir(termDir);
String termName = resource.getRequiredProperty(EX.localName).getString(); // Command
Model model = dataset.getNamedModel(resource.getURI());
for (Languages l : Languages.values()) {
File file = new File(termDir, String.format("%s.%s", termName, l.getExt()));
try (FileOutputStream fos = new FileOutputStream(file)) {
model.write(fos, l.getLang());
if(!ignoreTerms) {
for (ResIterator it = config.listResourcesWithProperty(RDF.type, RDFP.Resource); it.hasNext();) {
Resource resource = it.next();// https://saref.etsi.org/core/master/ -- https://saref.etsi.org/core/Command
String uri = resource.getURI();
try {
String termPath = uri.substring(Constants.BASE.length()); // core/Command
File termDir = new File(siteDir, termPath).getParentFile(); // core
FileUtils.forceMkdir(termDir);
String termName = resource.getRequiredProperty(EX.localName).getString(); // Command
Model model = dataset.getNamedModel(resource.getURI());
for (Languages l : Languages.values()) {
File file = new File(termDir, String.format("%s.%s", termName, l.getExt()));
try (FileOutputStream fos = new FileOutputStream(file)) {
model.write(fos, l.getLang());
}
}
File htmlFile = new File(termDir, String.format("%s.html", termName));
try (IndentedWriter writer = new IndentedWriter(new FileOutputStream(htmlFile));) {
Context context = ContextUtils.build(writer).setBase(Constants.BASE)
.setDebugTemplate(verbose).setInputDataset(dataset)
.setStreamManager(streamManager).build();
generateHTML(planForTerm, VAR_TERM, resource, context);
}
} catch (Exception ex) {
logger.error(String.format("Unexpected exception while writing static files for %s", resource), ex);
}
File htmlFile = new File(termDir, String.format("%s.html", termName));
try (IndentedWriter writer = new IndentedWriter(new FileOutputStream(htmlFile));) {
Context context = ContextUtils.build(writer).setBase(Constants.BASE)
.setDebugTemplate(verbose).setInputDataset(dataset)
.setStreamManager(streamManager).build();
generateHTML(planForTerm, VAR_TERM, resource, context);
}
} catch (Exception ex) {
logger.error(String.format("Unexpected exception while writing static files for %s", resource), ex);
}
}
for (ResIterator it = config.listResourcesWithProperty(RDF.type, EX.Example); it.hasNext();) {
Resource resource = it.next();// https://saref.etsi.org/core/master/example/doorswitch
String uri = resource.getURI();
try {
String exPath = uri.substring(Constants.BASE.length()); // core/master/example/doorswitch
File exDir = new File(siteDir, exPath).getParentFile(); // core/master/example
FileUtils.forceMkdir(exDir);
String exName = resource.getRequiredProperty(EX.localName).getString(); // doorswitch
Model model = dataset.getNamedModel(resource.getURI());
for (Languages l : Languages.values()) {
File file = new File(exDir, String.format("%s.%s", exName, l.getExt()));
try (FileOutputStream fos = new FileOutputStream(file)) {
model.write(fos, l.getLang());
if(!ignoreExamples) {
for (ResIterator it = config.listResourcesWithProperty(RDF.type, EX.Example); it.hasNext();) {
Resource resource = it.next();// https://saref.etsi.org/core/master/example/doorswitch
String uri = resource.getURI();
try {
String exPath = uri.substring(Constants.BASE.length()); // core/master/example/doorswitch
File exDir = new File(siteDir, exPath).getParentFile(); // core/master/example
FileUtils.forceMkdir(exDir);
String exName = resource.getRequiredProperty(EX.localName).getString(); // doorswitch
Model model = dataset.getNamedModel(resource.getURI());
for (Languages l : Languages.values()) {
File file = new File(exDir, String.format("%s.%s", exName, l.getExt()));
try (FileOutputStream fos = new FileOutputStream(file)) {
model.write(fos, l.getLang());
}
}
// File htmlFile = new File(exDir, String.format("%s.html", exName));
// try (IndentedWriter writer = new IndentedWriter(new FileOutputStream(htmlFile));) {
// Context context = ContextUtils.build(writer).setBase(Constants.BASE)
// .setDebugTemplate(!Constants.PRODUCTION).setInputDataset(dataset)
// .setStreamManager(streamManager).build();
// generateHTML(planForExample, VAR_EXAMPLE, resource, context);
// }
} catch (Exception ex) {
logger.error(String.format("Unexpected exception while writing static files for %s", resource), ex);
}
// File htmlFile = new File(exDir, String.format("%s.html", exName));
// try (IndentedWriter writer = new IndentedWriter(new FileOutputStream(htmlFile));) {
// Context context = ContextUtils.build(writer).setBase(Constants.BASE)
// .setDebugTemplate(!Constants.PRODUCTION).setInputDataset(dataset)
// .setStreamManager(streamManager).build();
// generateHTML(planForExample, VAR_EXAMPLE, resource, context);
// }
} catch (Exception ex) {
logger.error(String.format("Unexpected exception while writing static files for %s", resource), ex);
}
}
......
......@@ -155,7 +155,6 @@ public class ReadExamples extends JobRunner {
}
Resource reportResource = ValidationUtil.validateModel(model, shapeModel, true);
boolean conforms = reportResource.getProperty(SH.conforms).getBoolean();
boolean hasErrors = false;
if (!conforms) {
Model reportModel = reportResource.getModel();
reportModel.setNsPrefixes(PREFIXES);
......@@ -172,7 +171,6 @@ public class ReadExamples extends JobRunner {
if (severity != null && severity.getURI().equals(SHACL_VIOLATION)) {
logger.error(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage,
gotString));
hasErrors = true;
} else {
logger.warn(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage,
gotString));
......@@ -184,13 +182,11 @@ public class ReadExamples extends JobRunner {
ResIterator it = model.listSubjectsWithProperty(RDF.type, OWL2.Ontology);
if(!it.hasNext()) {
logger.error("There shall be exactly one owl:Ontology");
hasErrors = true;
}
while(it.hasNext()) {
Resource ontology = it.next();
if(onto++>1) {
logger.error("There shall be exactly one owl:Ontology");
hasErrors = true;
}
// check that this ontology is imported (without a version)
boolean found = false;
......@@ -203,18 +199,13 @@ public class ReadExamples extends JobRunner {
} else {
if(!uri.matches("^https://saref.etsi.org/(core|saref4[a-z]{4})/v[1-9][0-9]*\\\\.[1-9][0-9]*\\\\.[1-9][0-9]*/$")) {
logger.error("Only SAREF ontologies with specific versions shall be imported. Their URIs conform to the regular expression `^https://saref.etsi.org/(core|saref4[a-z]{4})/v[1-9][0-9]*\\\\.[1-9][0-9]*\\\\.[1-9][0-9]*/$`");
hasErrors = true;
}
}
}
if(!found) {
logger.error(String.format("The current ontology shall be imported: <%s>", version.getRepository().getNamespace()));
hasErrors = true;
}
}
if(hasErrors) {
throw new SAREFPipelineException("There were rrrors while checking the example structure");
}
}
private void updateExampleMetadata(Version version, Model model, Resource example) throws Exception {
......
......@@ -150,7 +150,6 @@ public class ReadOntology extends JobRunner {
}
Resource reportResource = ValidationUtil.validateModel(model, shapeModel, true);
boolean conforms = reportResource.getProperty(SH.conforms).getBoolean();
boolean hasErrors = false;
if (!conforms) {
Model reportModel = reportResource.getModel();
reportModel.setNsPrefixes(PREFIXES);
......@@ -167,7 +166,6 @@ public class ReadOntology extends JobRunner {
if (severity != null && severity.getURI().equals(SHACL_VIOLATION)) {
logger.error(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage,
gotString));
hasErrors = true;
} else {
logger.warn(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage,
gotString));
......@@ -180,27 +178,23 @@ public class ReadOntology extends JobRunner {
Resource ontology = it.next();
if(onto++>1) {
logger.error("There shall be only one owl:Ontology");
hasErrors = true;
}
if(version instanceof ReleaseVersion) {
int source = 0;
NodeIterator its = model.listObjectsOfProperty(ontology, DCTerms.source);
if(!its.hasNext()) {
logger.warn(SOURCE_ERROR);
}
while(its.hasNext()) {
if(source++>1) {
logger.warn(SOURCE_ERROR);
}
RDFNode s = its.next();
if(!s.isURIResource() || !s.asResource().getURI().startsWith("http://www.etsi.org/deliver/etsi_ts/")) {
logger.warn(SOURCE_ERROR);
}
}
}
}
if(hasErrors) {
throw new SAREFPipelineException("There were errors while checking the ontology structure");
// if(version instanceof ReleaseVersion) {
// int source = 0;
// NodeIterator its = model.listObjectsOfProperty(ontology, DCTerms.source);
// if(!its.hasNext()) {
// logger.warn(SOURCE_ERROR);
// }
// while(its.hasNext()) {
// if(source++>1) {
// logger.warn(SOURCE_ERROR);
// }
// RDFNode s = its.next();
// if(!s.isURIResource() || !s.asResource().getURI().startsWith("http://www.etsi.org/deliver/etsi_ts/")) {
// logger.warn(SOURCE_ERROR);
// }
// }
// }
}
}
......
......@@ -87,11 +87,14 @@ public class ReadRepositories extends JobRunner {
}
}
final File confFile = new File(directory, CONFIGURATION_FILE_NAME);
if(!confFile.exists()) {
return repositories;
}
YAMLRepos repos;
try {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
repos = mapper.readValue(confFile, YAMLRepos.class);
} catch (Exception ex) {
} catch (IOException ex) {
logger.warn(String.format("Error while reading the list of repositories \"%s\"", CONFIGURATION_FILE_NAME), ex);
return repositories;
}
......
......@@ -43,7 +43,7 @@ hasdomain=has domain
hasrange=has range
importedontologies=Imported Ontologies
individualassertions=has facts
authors=Authors
creators=Creators
contributors=Contributors
publisher=Publisher
toc=Table of Content
......
......@@ -33,7 +33,7 @@ TEMPLATE <classes.rqg>() {
"\n<div id='{fun:prefixedIRI(?class)}' class='entity'>" BOX {
"<a name='{?class}'></a>"
"\n<h3>"
TEMPLATE { ?label } WHERE { ?class rdfs:label ?label } LIMIT 1 .
TEMPLATE <term/label.rqg>( ?class ) .
<ontology/backlink.rqg>("classes", "Class")
"</h3>"
"\n<p><strong>IRI:</strong> { ?class }</p>"
......
......@@ -33,7 +33,7 @@ TEMPLATE <dataProperties.rqg>( ) {
"\n<div id='{fun:prefixedIRI(?dp)}' class='entity'>" BOX {
"<a name='{?dp}'></a>"
"\n<h3>"
TEMPLATE { ?label } WHERE { ?dp rdfs:label ?label } LIMIT 1 .
TEMPLATE <term/label.rqg>( ?dp ) .
<ontology/backlink.rqg>("dataproperties", "Data Property")
"</h3>"
"\n<p><strong>IRI:</strong> { ?dp }</p>"
......
......@@ -13,14 +13,14 @@ PREFIX schema: <http://schema.org/>
TEMPLATE <ontology/main.rqg>( ?versionIRI ) {
TEMPLATE <header.rqg>(?before, ?pathToStatic , true ).
TEMPLATE <header.rqg>( st:call-template(<ontology/title.rqg>, ?onto ) , ?pathToStatic , true ) .
"""
<header id="g-header">
<div class="g-container">
<div class="g-block size-100">
<div class="g-content g-particle">
<h1><a href="{?onto}">{ ?before }</a></h1>
<h1><a href="{?onto}">{ st:call-template(<ontology/title.rqg>, ?onto ) }</a></h1>
<dl>
<dt>Latest version:</dt><dd><a href='{?onto}'>{?onto}</a></dd>
{
......@@ -37,19 +37,33 @@ TEMPLATE <ontology/main.rqg>( ?versionIRI ) {
TEMPLATE { "<dt>" fun:property(<en.properties>, 'etsiSource') "</dt><dd>" ?source "</dd>" }
WHERE {
?onto dcterms:source ?source
} ORDER BY DESC(?source) LIMIT 1 .
} ORDER BY DESC(?source) .
}
{
TEMPLATE { "<dt>" fun:property(<en.properties>, 'publicationDate') "</dt><dd>" ?date "</dd>" }
WHERE {
?onto dcterms:issued ?date
} ORDER BY DESC(?date) LIMIT 1 .
} ORDER BY DESC(?date) .
}
{
TEMPLATE { "<dt>" fun:property(<en.properties>, 'modificationDate') "</dt><dd>" ?date "</dd>" }
WHERE {
?onto dcterms:modified ?date
} ORDER BY DESC(?date) LIMIT 1 .
} ORDER BY DESC(?date) .
}
{
TEMPLATE {
before="<dt>{fun:property(<en.properties>, 'creators')}</dt><dd>\n" ;
TEMPLATE <ontology/contributor.rqg>(?uri) .
; separator = "<br/>\n"
; after = "</dd>"
} WHERE {
?onto dcterms:creator ?uri
OPTIONAL {
{ ?uri schema:familyName ?contributorName }
UNION { ?uri foaf:name ?contributorName }
}
} ORDER BY ?contributorName ?uri .
}
{
TEMPLATE {
......@@ -269,8 +283,6 @@ WHERE {
BIND( fun:regex( str(?versionIRI), "^https://saref.etsi.org/([a-z4]+)/(v[0-9]+\\.[0-9]+\\.[0-9]+)/$", 2 ) AS ?versionInfo )
BIND( IRI( fun:regex( str(?versionIRI), "^(https://saref.etsi.org/[a-z4]+/)", 1 ) ) AS ?onto )
BIND( "../../static" AS ?pathToStatic )
?onto a owl:Ontology ;
dcterms:title ?title .
BIND(REPLACE(?title, "[\n|\r|\r\n].*", "") AS ?before )
?onto a owl:Ontology .
}
#LIMIT 1
......@@ -23,15 +23,9 @@ TEMPLATE <namedIndividuals.rqg>( ) {
before = "\n<ul class='hlist'>" ;
BOX {
"\n<li>"
TEMPLATE {
"\n<a href='#{fun:prefixedIRI(?individual)}' title='{fun:prefixedIRI(?individual)}'>"
?name
TEMPLATE <term/label.rqg>( ?individual ) .
"</a>"
} WHERE {
OPTIONAL { ?individual rdfs:label ?label }
BIND( COALESCE( ?name , fun:prefixedIRI(?individual) ) AS ?name )
}
LIMIT 1 .
"\n</li>"
}
; after = "\n</ul>"
......@@ -45,7 +39,7 @@ TEMPLATE <namedIndividuals.rqg>( ) {
"\n<div id='{fun:prefixedIRI(?individual)}' class='entity'>" BOX {
"<a name='{?individual}'></a>"
"\n<h3>"
TEMPLATE { ?label } WHERE { ?individual rdfs:label ?label } LIMIT 1 .
TEMPLATE <term/label.rqg>( ?individual ) .
<ontology/backlink.rqg>("namedindividuals", "Named Individuals")
"</h3>"
"\n<p><strong>IRI:</strong> { ?individual }</p>"
......
......@@ -33,7 +33,7 @@ TEMPLATE <objectProperties.rqg>() {
"\n<div id='{fun:prefixedIRI(?op)}' class='entity'>" BOX {
"<a name='{?op}'></a>"
"\n<h3>"
TEMPLATE { ?label } WHERE { ?op rdfs:label ?label } LIMIT 1 .
TEMPLATE <term/label.rqg>( ?op ) .
<ontology/backlink.rqg>("objectproperties", "Object Property")
"</h3>"
"\n<p><strong>IRI:</strong> { ?op }</p>"
......
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX fun: <http://w3id.org/sparql-generate/fn/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
BASE <https://saref.etsi.org/documentation/>
TEMPLATE <ontology/title.rqg>( ?ontology ) {
TEMPLATE { ?title } WHERE { ?ontology dcterms:title|dc:title ?title } LIMIT 1 .
TEMPLATE { ?title } WHERE { ?ontology rdfs:label ?title FILTER NOT EXISTS{ ?ontology dcterms:title|dc:title ?title } } LIMIT 1 .
TEMPLATE { "!! no label !!" } WHERE { FILTER NOT EXISTS{ ?ontology dcterms:title|dc:title|rdfs:label ?title } } .
}
\ No newline at end of file
......@@ -7,9 +7,7 @@ TEMPLATE <ontology/toc-bar.rqg>( ?entity , ?property ) {
before = "\n<ul>" ;
BOX { "\n<li>"
TEMPLATE {
<function/hrefTitle.rqg>(fun:prefixedIRI(?entity),?label)
} WHERE { OPTIONAL{ ?entity rdfs:label ?label } } LIMIT 1 .
<function/hrefTitle.rqg>(fun:prefixedIRI(?entity), TEMPLATE <term/label.rqg>( ?entity ) . )
TEMPLATE <ontology/toc-bar.rqg>( ?sub , ?property )
WHERE {
......
......@@ -6,9 +6,7 @@ BASE <https://saref.etsi.org/documentation/>
TEMPLATE <ontology/toc.rqg>( ?entity ) {
before = "\n<ul class='hlist'>" ;
BOX { "\n<li>"
TEMPLATE {
<function/hrefTitle.rqg>(fun:prefixedIRI(?entity),?label)
} WHERE { ?entity rdfs:label ?label } LIMIT 1 .
<function/hrefTitle.rqg>(fun:prefixedIRI(?entity), TEMPLATE <term/label.rqg>( ?entity ) . )
"</li>" }
; after = "\n</ul>"
}
\ No newline at end of file
......@@ -15,15 +15,12 @@ BASE <https://saref.etsi.org/documentation/>
TEMPLATE <term/classDescription.rqg>( ?class , ?first ) {
TEMPLATE {
"<a href='#{fun:prefixedIRI(?class)}' title='{?labelStr}: {?commentStr}'>{fun:prefixedIRI(?class)}</a>"
"<a href='#{fun:prefixedIRI(?class)}' title='{ st:call-template(<term/label.rqg>, ?class ) }: {?commentStr}'>{fun:prefixedIRI(?class)}</a>"
"<sup title='{ fun:property(<en.properties>, 'class') }' class='type-c'>c</sup>"
}
WHERE {
FILTER(ISURI(?class))
OPTIONAL {
?class rdfs:label ?label ;
rdfs:comment ?comment }
BIND( IF(BOUND(?label), ?label, "<<no label>>") AS ?labelStr )
OPTIONAL { ?class rdfs:comment ?comment }
BIND( IF(BOUND(?comment), ?comment, "<<no comment>>") AS ?commentStr )
} .
......
......@@ -18,13 +18,11 @@ TEMPLATE <term/individualAndLiteralDescription.rqg>( ?object ) {
# named individual
TEMPLATE {
"<a href='#{fun:prefixedIRI(?object)}' title='{?labelStr}: {?commentStr}'>{fun:prefixedIRI(?object)}</a>"
"<a href='#{fun:prefixedIRI(?object)}' title='{ st:call-template(<term/label.rqg>, ?object ) }: {?commentStr}'>{fun:prefixedIRI(?object)}</a>"
"<sup title='{ fun:property(<en.properties>, 'namedindividual') }' class='type-ni'>ni</sup>"
} WHERE {
FILTER(ISURI(?object))
OPTIONAL {?object rdfs:label ?label}
OPTIONAL {?object rdfs:comment ?comment }
BIND( IF(BOUND(?label), ?label, "<<no label>>") AS ?labelStr )
BIND( IF(BOUND(?comment), ?comment, "<<no comment>>") AS ?commentStr )
} .
......
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 fun: <http://w3id.org/sparql-generate/fn/>
BASE <https://saref.etsi.org/documentation/>
TEMPLATE <term/label.rqg>( ?s ) {
TEMPLATE { ?label } WHERE { ?s skos:prefLabel ?label } LIMIT 1 .
TEMPLATE { ?label ; separator = ", aka " } WHERE { ?s rdfs:label ?label FILTER NOT EXISTS{ ?s skos:prefLabel ?label } } .
TEMPLATE { COALESCE( fun:prefixedIRI(?s) , "!! no label !!" ) } WHERE { FILTER NOT EXISTS{ ?s skos:prefLabel|rdfs:label ?label } } .
}
\ No newline at end of file
......@@ -11,14 +11,14 @@ PREFIX ex: <http://example.org/>
TEMPLATE <term/main.rqg>( ?term ) {
TEMPLATE <header.rqg>(?before, ?pathToStatic , false ).
TEMPLATE <header.rqg>( TEMPLATE <term/label.rqg>( ?term ) . , ?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>
<h1><a href="{?term}">{?prefix}{?localName}</a> ({ TEMPLATE <term/label.rqg>( ?term ) . })</h1>
<p><em>Defined in <a href="{?ontoRef}">{?ontoRef}</a> as: </em></p>
<p>{ TEMPLATE { ?description } WHERE { ?term rdfs:comment ?description } . }</p>
<dl>
......@@ -80,10 +80,8 @@ WHERE {
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
?term rdfs:isDefinedBy ?ontoRef
BIND(REPLACE(?title, "[\n|\r|\r\n].*", "") AS ?before )
BIND( "../static" AS ?pathToStatic )
}
......
......@@ -18,18 +18,15 @@ TEMPLATE <term/propertyDescription.rqg>( ?property ) {
# named object property
TEMPLATE {
"<a href='#{fun:prefixedIRI(?property)}' title='{?labelStr}: {?commentStr}'>{fun:prefixedIRI(?property)}</a>"
"<a href='#{fun:prefixedIRI(?property)}' title='{ st:call-template( <term/label.rqg>, ?property ) }: {?commentStr}'>{fun:prefixedIRI(?property)}</a>"
"<sup title='{ fun:property(<en.properties>, 'objectproperty') }' class='type-op'>op</sup>"
}
WHERE {
FILTER(ISURI(?property))
?property a owl:ObjectProperty ;
OPTIONAL {
?property rdfs:label ?label ;
rdfs:comment ?comment }
OPTIONAL { ?property rdfs:comment ?comment }
FILTER (?property != owl:topObjectProperty)
FILTER (?property != owl:bottomObjectProperty)
BIND( IF(BOUND(?label), ?label, "<<no label>>") AS ?labelStr )
BIND( IF(BOUND(?comment), ?comment, "<<no comment>>") AS ?commentStr )
} .
......
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