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 { ...@@ -39,10 +39,14 @@ public class CMDConfigurations {
public static final String ARG_IGNORE_EXAMPLES = "e"; 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_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_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 = "s";
public static final String ARG_NO_SITE_LONG = "no-site"; 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_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 = "m";
public static final String ARG_INCLUDE_MASTER_LONG = "master"; public static final String ARG_INCLUDE_MASTER_LONG = "master";
...@@ -66,6 +70,7 @@ public class CMDConfigurations { ...@@ -66,6 +70,7 @@ public class CMDConfigurations {
.addOption(ARG_IGNORE_EXAMPLES, ARG_IGNORE_EXAMPLES_LONG, false, ARG_IGNORE_EXAMPLES_MAN) .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_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_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_INCLUDE_MASTER, ARG_INCLUDE_MASTER_LONG, false, ARG_INCLUDE_MASTER_MAN)
.addOption(ARG_VERBOSE, ARG_VERBOSE_LONG, false, ARG_VERBOSE_MAN); .addOption(ARG_VERBOSE, ARG_VERBOSE_LONG, false, ARG_VERBOSE_MAN);
} }
......
...@@ -102,6 +102,7 @@ public class Main { ...@@ -102,6 +102,7 @@ public class Main {
static boolean ignoreGit; static boolean ignoreGit;
static boolean includeMaster; static boolean includeMaster;
static boolean generateSite; static boolean generateSite;
static boolean ignoreTerms;
static boolean ignoreExamples; static boolean ignoreExamples;
static boolean verbose; static boolean verbose;
...@@ -124,6 +125,7 @@ public class Main { ...@@ -124,6 +125,7 @@ public class Main {
includeMaster = cl.hasOption(ARG_INCLUDE_MASTER); includeMaster = cl.hasOption(ARG_INCLUDE_MASTER);
generateSite = !cl.hasOption(ARG_NO_SITE); generateSite = !cl.hasOption(ARG_NO_SITE);
ignoreExamples = cl.hasOption(ARG_IGNORE_EXAMPLES); ignoreExamples = cl.hasOption(ARG_IGNORE_EXAMPLES);
ignoreTerms = cl.hasOption(ARG_IGNORE_TERMS);
verbose = cl.hasOption(ARG_VERBOSE); verbose = cl.hasOption(ARG_VERBOSE);
setLogAppenders(); setLogAppenders();
...@@ -154,7 +156,7 @@ public class Main { ...@@ -154,7 +156,7 @@ public class Main {
new CheckConfig().doJob(dataset, ignoreExamples); new CheckConfig().doJob(dataset, ignoreExamples);
if (generateSite) { 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 { ...@@ -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); File siteDir = new File(directory, Constants.SITE_DIR);
dataset.begin(ReadWrite.READ); dataset.begin(ReadWrite.READ);
Model config = dataset.getNamedModel(Constants.CONFIG); Model config = dataset.getNamedModel(Constants.CONFIG);
...@@ -110,57 +110,61 @@ public class GeneratePortal extends JobRunner { ...@@ -110,57 +110,61 @@ public class GeneratePortal extends JobRunner {
} }
} }
for (ResIterator it = config.listResourcesWithProperty(RDF.type, RDFP.Resource); it.hasNext();) { if(!ignoreTerms) {
Resource resource = it.next();// https://saref.etsi.org/core/master/ -- https://saref.etsi.org/core/Command for (ResIterator it = config.listResourcesWithProperty(RDF.type, RDFP.Resource); it.hasNext();) {
String uri = resource.getURI(); Resource resource = it.next();// https://saref.etsi.org/core/master/ -- https://saref.etsi.org/core/Command
try { String uri = resource.getURI();
String termPath = uri.substring(Constants.BASE.length()); // core/Command try {
File termDir = new File(siteDir, termPath).getParentFile(); // core String termPath = uri.substring(Constants.BASE.length()); // core/Command
FileUtils.forceMkdir(termDir); File termDir = new File(siteDir, termPath).getParentFile(); // core
String termName = resource.getRequiredProperty(EX.localName).getString(); // Command FileUtils.forceMkdir(termDir);
Model model = dataset.getNamedModel(resource.getURI()); String termName = resource.getRequiredProperty(EX.localName).getString(); // Command
for (Languages l : Languages.values()) { Model model = dataset.getNamedModel(resource.getURI());
File file = new File(termDir, String.format("%s.%s", termName, l.getExt())); for (Languages l : Languages.values()) {
try (FileOutputStream fos = new FileOutputStream(file)) { File file = new File(termDir, String.format("%s.%s", termName, l.getExt()));
model.write(fos, l.getLang()); 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();) { if(!ignoreExamples) {
Resource resource = it.next();// https://saref.etsi.org/core/master/example/doorswitch for (ResIterator it = config.listResourcesWithProperty(RDF.type, EX.Example); it.hasNext();) {
String uri = resource.getURI(); Resource resource = it.next();// https://saref.etsi.org/core/master/example/doorswitch
try { String uri = resource.getURI();
String exPath = uri.substring(Constants.BASE.length()); // core/master/example/doorswitch try {
File exDir = new File(siteDir, exPath).getParentFile(); // core/master/example String exPath = uri.substring(Constants.BASE.length()); // core/master/example/doorswitch
FileUtils.forceMkdir(exDir); File exDir = new File(siteDir, exPath).getParentFile(); // core/master/example
String exName = resource.getRequiredProperty(EX.localName).getString(); // doorswitch FileUtils.forceMkdir(exDir);
Model model = dataset.getNamedModel(resource.getURI()); String exName = resource.getRequiredProperty(EX.localName).getString(); // doorswitch
for (Languages l : Languages.values()) { Model model = dataset.getNamedModel(resource.getURI());
File file = new File(exDir, String.format("%s.%s", exName, l.getExt())); for (Languages l : Languages.values()) {
try (FileOutputStream fos = new FileOutputStream(file)) { File file = new File(exDir, String.format("%s.%s", exName, l.getExt()));
model.write(fos, l.getLang()); 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 { ...@@ -155,7 +155,6 @@ public class ReadExamples extends JobRunner {
} }
Resource reportResource = ValidationUtil.validateModel(model, shapeModel, true); Resource reportResource = ValidationUtil.validateModel(model, shapeModel, true);
boolean conforms = reportResource.getProperty(SH.conforms).getBoolean(); boolean conforms = reportResource.getProperty(SH.conforms).getBoolean();
boolean hasErrors = false;
if (!conforms) { if (!conforms) {
Model reportModel = reportResource.getModel(); Model reportModel = reportResource.getModel();
reportModel.setNsPrefixes(PREFIXES); reportModel.setNsPrefixes(PREFIXES);
...@@ -172,7 +171,6 @@ public class ReadExamples extends JobRunner { ...@@ -172,7 +171,6 @@ public class ReadExamples extends JobRunner {
if (severity != null && severity.getURI().equals(SHACL_VIOLATION)) { if (severity != null && severity.getURI().equals(SHACL_VIOLATION)) {
logger.error(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage, logger.error(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage,
gotString)); gotString));
hasErrors = true;
} else { } else {
logger.warn(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage, logger.warn(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage,
gotString)); gotString));
...@@ -184,13 +182,11 @@ public class ReadExamples extends JobRunner { ...@@ -184,13 +182,11 @@ public class ReadExamples extends JobRunner {
ResIterator it = model.listSubjectsWithProperty(RDF.type, OWL2.Ontology); ResIterator it = model.listSubjectsWithProperty(RDF.type, OWL2.Ontology);
if(!it.hasNext()) { if(!it.hasNext()) {
logger.error("There shall be exactly one owl:Ontology"); logger.error("There shall be exactly one owl:Ontology");
hasErrors = true;
} }
while(it.hasNext()) { while(it.hasNext()) {
Resource ontology = it.next(); Resource ontology = it.next();
if(onto++>1) { if(onto++>1) {
logger.error("There shall be exactly one owl:Ontology"); logger.error("There shall be exactly one owl:Ontology");
hasErrors = true;
} }
// check that this ontology is imported (without a version) // check that this ontology is imported (without a version)
boolean found = false; boolean found = false;
...@@ -203,18 +199,13 @@ public class ReadExamples extends JobRunner { ...@@ -203,18 +199,13 @@ public class ReadExamples extends JobRunner {
} else { } 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]*/$")) { 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]*/$`"); 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) { if(!found) {
logger.error(String.format("The current ontology shall be imported: <%s>", version.getRepository().getNamespace())); 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 { private void updateExampleMetadata(Version version, Model model, Resource example) throws Exception {
......
...@@ -150,7 +150,6 @@ public class ReadOntology extends JobRunner { ...@@ -150,7 +150,6 @@ public class ReadOntology extends JobRunner {
} }
Resource reportResource = ValidationUtil.validateModel(model, shapeModel, true); Resource reportResource = ValidationUtil.validateModel(model, shapeModel, true);
boolean conforms = reportResource.getProperty(SH.conforms).getBoolean(); boolean conforms = reportResource.getProperty(SH.conforms).getBoolean();
boolean hasErrors = false;
if (!conforms) { if (!conforms) {
Model reportModel = reportResource.getModel(); Model reportModel = reportResource.getModel();
reportModel.setNsPrefixes(PREFIXES); reportModel.setNsPrefixes(PREFIXES);
...@@ -167,7 +166,6 @@ public class ReadOntology extends JobRunner { ...@@ -167,7 +166,6 @@ public class ReadOntology extends JobRunner {
if (severity != null && severity.getURI().equals(SHACL_VIOLATION)) { if (severity != null && severity.getURI().equals(SHACL_VIOLATION)) {
logger.error(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage, logger.error(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage,
gotString)); gotString));
hasErrors = true;
} else { } else {
logger.warn(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage, logger.warn(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage,
gotString)); gotString));
...@@ -180,27 +178,23 @@ public class ReadOntology extends JobRunner { ...@@ -180,27 +178,23 @@ public class ReadOntology extends JobRunner {
Resource ontology = it.next(); Resource ontology = it.next();
if(onto++>1) { if(onto++>1) {
logger.error("There shall be only one owl:Ontology"); logger.error("There shall be only one owl:Ontology");
hasErrors = true;
} }
if(version instanceof ReleaseVersion) { // if(version instanceof ReleaseVersion) {
int source = 0; // int source = 0;
NodeIterator its = model.listObjectsOfProperty(ontology, DCTerms.source); // NodeIterator its = model.listObjectsOfProperty(ontology, DCTerms.source);
if(!its.hasNext()) { // if(!its.hasNext()) {
logger.warn(SOURCE_ERROR); // logger.warn(SOURCE_ERROR);
} // }
while(its.hasNext()) { // while(its.hasNext()) {
if(source++>1) { // if(source++>1) {
logger.warn(SOURCE_ERROR); // logger.warn(SOURCE_ERROR);
} // }
RDFNode s = its.next(); // RDFNode s = its.next();
if(!s.isURIResource() || !s.asResource().getURI().startsWith("http://www.etsi.org/deliver/etsi_ts/")) { // if(!s.isURIResource() || !s.asResource().getURI().startsWith("http://www.etsi.org/deliver/etsi_ts/")) {
logger.warn(SOURCE_ERROR); // logger.warn(SOURCE_ERROR);
} // }
} // }
} // }
}
if(hasErrors) {
throw new SAREFPipelineException("There were errors while checking the ontology structure");
} }
} }
......
...@@ -87,11 +87,14 @@ public class ReadRepositories extends JobRunner { ...@@ -87,11 +87,14 @@ public class ReadRepositories extends JobRunner {
} }
} }
final File confFile = new File(directory, CONFIGURATION_FILE_NAME); final File confFile = new File(directory, CONFIGURATION_FILE_NAME);
if(!confFile.exists()) {
return repositories;
}
YAMLRepos repos; YAMLRepos repos;
try { try {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
repos = mapper.readValue(confFile, YAMLRepos.class); 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); logger.warn(String.format("Error while reading the list of repositories \"%s\"", CONFIGURATION_FILE_NAME), ex);
return repositories; return repositories;
} }
......
...@@ -43,7 +43,7 @@ hasdomain=has domain ...@@ -43,7 +43,7 @@ hasdomain=has domain
hasrange=has range hasrange=has range
importedontologies=Imported Ontologies importedontologies=Imported Ontologies
individualassertions=has facts individualassertions=has facts
authors=Authors creators=Creators
contributors=Contributors contributors=Contributors
publisher=Publisher publisher=Publisher
toc=Table of Content toc=Table of Content
......
...@@ -33,7 +33,7 @@ TEMPLATE <classes.rqg>() { ...@@ -33,7 +33,7 @@ TEMPLATE <classes.rqg>() {
"\n<div id='{fun:prefixedIRI(?class)}' class='entity'>" BOX { "\n<div id='{fun:prefixedIRI(?class)}' class='entity'>" BOX {
"<a name='{?class}'></a>" "<a name='{?class}'></a>"
"\n<h3>" "\n<h3>"
TEMPLATE { ?label } WHERE { ?class rdfs:label ?label } LIMIT 1 . TEMPLATE <term/label.rqg>( ?class ) .
<ontology/backlink.rqg>("classes", "Class") <ontology/backlink.rqg>("classes", "Class")
"</h3>" "</h3>"
"\n<p><strong>IRI:</strong> { ?class }</p>" "\n<p><strong>IRI:</strong> { ?class }</p>"
......
...@@ -33,7 +33,7 @@ TEMPLATE <dataProperties.rqg>( ) { ...@@ -33,7 +33,7 @@ TEMPLATE <dataProperties.rqg>( ) {
"\n<div id='{fun:prefixedIRI(?dp)}' class='entity'>" BOX { "\n<div id='{fun:prefixedIRI(?dp)}' class='entity'>" BOX {
"<a name='{?dp}'></a>" "<a name='{?dp}'></a>"
"\n<h3>" "\n<h3>"
TEMPLATE { ?label } WHERE { ?dp rdfs:label ?label } LIMIT 1 . TEMPLATE <term/label.rqg>( ?dp ) .
<ontology/backlink.rqg>("dataproperties", "Data Property") <ontology/backlink.rqg>("dataproperties", "Data Property")
"</h3>" "</h3>"
"\n<p><strong>IRI:</strong> { ?dp }</p>" "\n<p><strong>IRI:</strong> { ?dp }</p>"
......
...@@ -13,14 +13,14 @@ PREFIX schema: <http://schema.org/> ...@@ -13,14 +13,14 @@ PREFIX schema: <http://schema.org/>
TEMPLATE <ontology/main.rqg>( ?versionIRI ) { 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"> <header id="g-header">
<div class="g-container"> <div class="g-container">
<div class="g-block size-100"> <div class="g-block size-100">
<div class="g-content g-particle"> <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> <dl>
<dt>Latest version:</dt><dd><a href='{?onto}'>{?onto}</a></dd> <dt>Latest version:</dt><dd><a href='{?onto}'>{?onto}</a></dd>
{ {
...@@ -37,19 +37,33 @@ TEMPLATE <ontology/main.rqg>( ?versionIRI ) { ...@@ -37,19 +37,33 @@ TEMPLATE <ontology/main.rqg>( ?versionIRI ) {
TEMPLATE { "<dt>" fun:property(<en.properties>, 'etsiSource') "</dt><dd>" ?source "</dd>" } TEMPLATE { "<dt>" fun:property(<en.properties>, 'etsiSource') "</dt><dd>" ?source "</dd>" }
WHERE { WHERE {
?onto dcterms:source ?source ?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>" } TEMPLATE { "<dt>" fun:property(<en.properties>, 'publicationDate') "</dt><dd>" ?date "</dd>" }
WHERE { WHERE {
?onto dcterms:issued ?date ?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>" } TEMPLATE { "<dt>" fun:property(<en.properties>, 'modificationDate') "</dt><dd>" ?date "</dd>" }
WHERE { WHERE {
?onto dcterms:modified ?date ?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 { TEMPLATE {
...@@ -269,8 +283,6 @@ WHERE { ...@@ -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( 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( IRI( fun:regex( str(?versionIRI), "^(https://saref.etsi.org/[a-z4]+/)", 1 ) ) AS ?onto )
BIND( "../../static" AS ?pathToStatic ) BIND( "../../static" AS ?pathToStatic )
?onto a owl:Ontology ; ?onto a owl:Ontology .
dcterms:title ?title .
BIND(REPLACE(?title, "[\n|\r|\r\n].*", "") AS ?before )
} }
#LIMIT 1 #LIMIT 1
...@@ -23,15 +23,9 @@ TEMPLATE <namedIndividuals.rqg>( ) { ...@@ -23,15 +23,9 @@ TEMPLATE <namedIndividuals.rqg>( ) {
before = "\n<ul class='hlist'>" ; before = "\n<ul class='hlist'>" ;
BOX { BOX {
"\n<li>" "\n<li>"
TEMPLATE {
"\n<a href='#{fun:prefixedIRI(?individual)}' title='{fun:prefixedIRI(?individual)}'>" "\n<a href='#{fun:prefixedIRI(?individual)}' title='{fun:prefixedIRI(?individual)}'>"
?name TEMPLATE <term/label.rqg>( ?individual ) .
"</a>" "</a>"
} WHERE {
OPTIONAL { ?individual rdfs:label ?label }
BIND( COALESCE( ?name , fun:prefixedIRI(?individual) ) AS ?name )
}
LIMIT 1 .
"\n</li>" "\n</li>"
} }
; after = "\n</ul>" ; after = "\n</ul>"
...@@ -45,7 +39,7 @@ TEMPLATE <namedIndividuals.rqg>( ) { ...@@ -45,7 +39,7 @@ TEMPLATE <namedIndividuals.rqg>( ) {
"\n<div id='{fun:prefixedIRI(?individual)}' class='entity'>" BOX { "\n<div id='{fun:prefixedIRI(?individual)}' class='entity'>" BOX {
"<a name='{?individual}'></a>" "<a name='{?individual}'></a>"
"\n<h3>" "\n<h3>"
TEMPLATE { ?label } WHERE { ?individual rdfs:label ?label } LIMIT 1 . TEMPLATE <term/label.rqg>( ?individual ) .
<ontology/backlink.rqg>("namedindividuals", "Named Individuals") <ontology/backlink.rqg>("namedindividuals", "Named Individuals")
"</h3>" "</h3>"
"\n<p><strong>IRI:</strong> { ?individual }</p>" "\n<p><strong>IRI:</strong> { ?individual }</p>"
......
...@@ -33,7 +33,7 @@ TEMPLATE <objectProperties.rqg>() { ...@@ -33,7 +33,7 @@ TEMPLATE <objectProperties.rqg>() {
"\n<div id='{fun:prefixedIRI(?op)}' class='entity'>" BOX { "\n<div id='{fun:prefixedIRI(?op)}' class='entity'>" BOX {
"<a name='{?op}'></a>" "<a name='{?op}'></a>"
"\n<h3>" "\n<h3>"
TEMPLATE { ?label } WHERE { ?op rdfs:label ?label } LIMIT 1 . TEMPLATE <term/label.rqg>( ?op ) .
<ontology/backlink.rqg>("objectproperties", "Object Property") <ontology/backlink.rqg>("objectproperties", "Object Property")
"</h3>" "</h3>"
"\n<p><strong>IRI:</strong> { ?op }</p>" "\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 ) { ...@@ -7,9 +7,7 @@ TEMPLATE <ontology/toc-bar.rqg>( ?entity , ?property ) {
before = "\n<ul>" ;