Skip to content

Commit

Permalink
Merge pull request #684 from dgarijo/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dgarijo authored Apr 1, 2024
2 parents b536685 + 5c1f5a3 commit 5e524f6
Show file tree
Hide file tree
Showing 33 changed files with 1,502 additions and 94 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ jobs:
# https://github.com/docker/metadata-action (lower cases image name, etc.)
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5.4.0
uses: docker/metadata-action@v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push
uses: docker/build-push-action@v5.1.0
uses: docker/build-push-action@v5.3.0
with:
push: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
tags: ${{ steps.meta.outputs.tags }}
Expand Down
47 changes: 25 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,58 +132,61 @@ docker run -ti --rm \

### Options

`-ontFile PATH` [required (unless -ontURI is used)]: Load a local ontology file (from PATH) to document. This option is incompatible with -ontURI
`-analytics CODE`: Add a code snippet for Google analytics to track your HTML documentation. You need to add your CODE next to the flag. For example: UA-1234

`-ontURI URI` [required (unless -ontFile is used)]: Load an ontology to document from its URI. This option is incompatible with -ontFile
`-confFile PATH`: Load your own configuration file for the ontology metadata. Incompatible with -getOntologyMetadata. See [the configuration documentation](doc/configuration/configuration_doc.md) for more information about the accepted fields.

`-outFolder folderName`: Specifies the name of the folder where to save the documentation. By default is 'myDocumentation'
`-crossRef`: ONLY generate the overview and cross reference sections. The index document will NOT be generated. The htaccess, provenance page, etc., will not be generated unless requested by other flags. This flag is intended to be used only after a first version of the documentation exists.

`-confFile PATH`: Load your own configuration file for the ontology metadata. Incompatible with -getOntologyMetadata. See [the configuration documentation](doc/configuration/configuration_doc.md) for more information about the accepted fields.
`-displayDirectImportsOnly`: Only those imported ontologies that are directly imported in the ontology being documented.

`-getOntologyMetadata`: Extract ontology metadata from the given ontology
`-doNotDisplaySerializations`: The serializations of the ontology will not be displayed.

`-oops`: Create an html page with the evaluation from the OOPS service (http://oops.linkeddata.es/)
`-excludeIntroduction`: Skip the introduction section in the documentation.

`-rewriteAll`: Replace any existing files when documenting an ontology (e.g., from a previous execution)
`-getOntologyMetadata`: Extract ontology metadata from the given ontology

`-crossRef`: ONLY generate the overview and cross reference sections. The index document will NOT be generated. The htaccess, provenance page, etc., will not be generated unless requested by other flags. This flag is intended to be used only after a first version of the documentation exists.
`--help`: Shows a help message and exits.

`-saveConfig PATH`: Save a configuration file on PATH with the properties of a given ontology
`-htaccess`: Create a bundle for publication ready to be deployed on your Apache server.

`-useCustomStyle`: Export the documentation using alternate css files (by Daniel Vila).

`-lang LANG1-LANG2`: Generate documentation in multiple languages (separated by "-"). Note that if the language is not supported, the system will load the labels in english. For example: en-pt-es
`-ignoreIndividuals`: Individuals will not be included in the documentation.

`-includeAnnotationProperties`: Include annotation properties defined in your ontology in the documentation (by default they are not included)

`-includeImportedOntologies`: Indicates whether the terms of the imported ontologies of the current ontology should be documented as well or not.

`-htaccess`: Create a bundle for publication ready to be deployed on your Apache server.
`-import`: imports a local ontology (e.g., if you don't want to load an online ontology, you may load its local version)

`-webVowl`: Create a visualization based on WebVowl (http://vowl.visualdataweb.org/webvowl/index.html#) in the documentation.
`-lang LANG1-LANG2`: Generate documentation in multiple languages (separated by "-"). Note that if the language is not supported, the system will load the labels in english. For example: en-pt-es

`-licensius`: Use the Licensius web services (http://licensius.com/apidoc/index.html) to retrieve license metadata. Only works if the -getOntologyMetadata flag is enabled.

`-ignoreIndividuals`: Individuals will not be included in the documentation.
`-noPlaceHolderText`: Do not add any placeholder text (this will remove intro, abstract (if empty) and description sections).

`-includeAnnotationProperties`: Include annotation properties defined in your ontology in the documentation (by default they are not included)
`-ontFile PATH` [required (unless -ontURI is used)]: Load a local ontology file (from PATH) to document. This option is incompatible with -ontURI

`-analytics CODE`: Add a code snippet for Google analytics to track your HTML documentation. You need to add your CODE next to the flag. For example: UA-1234
`-outFolder folderName`: Specifies the name of the folder where to save the documentation. By default is 'myDocumentation'

`-doNotDisplaySerializations`: The serializations of the ontology will not be displayed.
`-ontURI URI` [required (unless -ontFile is used)]: Load an ontology to document from its URI. This option is incompatible with -ontFile

`-displayDirectImportsOnly`: Only those imported ontologies that are directly imported in the ontology being documented.
`-oops`: Create an html page with the evaluation from the OOPS service (http://oops.linkeddata.es/)

`-rewriteAll`: Replace any existing files when documenting an ontology (e.g., from a previous execution)

`-rewriteBase PATH`: Change the default rewrite base path. The default value is "/". This flag can only be used with the htaccess option.

`-excludeIntroduction`: Skip the introduction section in the documentation.
`-saveConfig PATH`: Save a configuration file on PATH with the properties of a given ontology

`-uniteSections`: Write all HTML sections into a single HTML document.

`-noPlaceHolderText`: Do not add any placeholder text (this will remove intro, abstract (if empty) and description sections).

`--help`: Shows a help message and exits.
`-useCustomStyle`: Export the documentation using alternate css files (by Daniel Vila).

`--version`: Shows the version of WIDOCO.

`-webVowl`: Create a visualization based on WebVowl (http://vowl.visualdataweb.org/webvowl/index.html#) in the documentation.


## How can I make WIDOCO automatically recognize my vocabulary annotations?
There are two alternative ways for making WIDOCO get your vocabulary metadata annotations and use them automatically to document the ontology.
Expand Down
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
<version>3.9.0</version>
</dependency>


<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
</dependency>
<dependency>
<groupId>com.github.VisualDataWeb</groupId>
<artifactId>OWL2VOWL</artifactId>
Expand Down
32 changes: 19 additions & 13 deletions src/main/java/oops/OOPSevaluation.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,13 @@ else if (code.contentEquals("P36")) {
collect(Collectors.toList())).iterator();
if(elementos.hasNext()){
String first = ((OWLAnnotationAssertionAxiom)elementos.next()).getValue().asLiteral().get().getLiteral();
String second = ((OWLAnnotationAssertionAxiom)elementos.next()).getValue().asLiteral().get().getLiteral();
evaluationOutput = evaluationOutput + "<li>" + "<a href=\"" + first
+ "\" target=\"_blank\">" + first + "</a>" + " may not be inverse of "
+ "<a href=\"" + second + "\" target=\"_blank\">" + second + "</a>" + "</li>";
evaluationOutput = evaluationOutput + "</ul>";
if (elementos.hasNext()) {
String second = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().getLiteral();
evaluationOutput = evaluationOutput + "<li>" + "<a href=\"" + first
+ "\" target=\"_blank\">" + first + "</a>" + " may not be inverse of "
+ "<a href=\"" + second + "\" target=\"_blank\">" + second + "</a>" + "</li>";
evaluationOutput = evaluationOutput + "</ul>";
}
}
}
break;
Expand Down Expand Up @@ -324,10 +326,12 @@ else if (code.contentEquals("P36")) {
collect(Collectors.toList())).iterator();
while(elementos.hasNext()) {
String first = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString();
String second = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString();
evaluationOutput = evaluationOutput + "<li>" + "<a href=\"" + first
+ "\" target=\"_blank\">" + first + "</a>" + " , " + "<a href=\"" + second
+ "\" target=\"_blank\">" + second + "</a>" + "</li>";
if(elementos.hasNext()) {
String second = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString();
evaluationOutput = evaluationOutput + "<li>" + "<a href=\"" + first
+ "\" target=\"_blank\">" + first + "</a>" + " , " + "<a href=\"" + second
+ "\" target=\"_blank\">" + second + "</a>" + "</li>";
}
}
evaluationOutput = evaluationOutput + "</ul>";
}
Expand All @@ -347,10 +351,12 @@ else if (code.contentEquals("P36")) {
collect(Collectors.toList())).iterator();
while(elementos.hasNext()) {
String first = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString();
String second = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString();
evaluationOutput = evaluationOutput + "<li>" + "<a href=\"" + first
+ "\" target=\"_blank\">" + first + "</a>" + " , " + "<a href=\"" + second
+ "\" target=\"_blank\">" + second + "</a>" + "</li>";
if(elementos.hasNext()) {
String second = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString();
evaluationOutput = evaluationOutput + "<li>" + "<a href=\"" + first
+ "\" target=\"_blank\">" + first + "</a>" + " , " + "<a href=\"" + second
+ "\" target=\"_blank\">" + second + "</a>" + "</li>";
}
}
evaluationOutput = evaluationOutput + "</ul>";
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/widoco/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public class Configuration {
private boolean includeAllSectionsInOneDocument; //boolean to indicate all sections should be included in a single big HTML
private HashMap<String, String> namespaceDeclarations; //Namespace declarations to be included in the documentation.
private String introText;// in case there is an explicit annotation in the ontology
private List<File> imports = new ArrayList<>();

/**
* Variable to keep track of possible errors in the changelog. If there are
Expand Down Expand Up @@ -1050,6 +1051,12 @@ public void setOntologyURI(String ontologyURI) {
this.mainOntologyMetadata.setNamespaceURI(ontologyURI);
}

public void setImports(List<String> imports) {
for (String importStr:imports) {
this.imports.add(new File(importStr));
}
}

public void setPublishProvenance(boolean publishProvenance) {
this.publishProvenance = publishProvenance;
}
Expand All @@ -1074,6 +1081,10 @@ public String getReferencesPath() {
return referencesPath;
}

public List<File> getImports() {
return this.imports;
}

public boolean isIncludeAbstract() {
return includeAbstract;
}
Expand Down
59 changes: 38 additions & 21 deletions src/main/java/widoco/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import widoco.entities.Agent;
import widoco.entities.Ontology;
import widoco.ExternalPropertyParser;

/**
*
Expand Down Expand Up @@ -337,6 +338,7 @@ public class Constants {
public static final String LANG_CLASSES = "classes";
public static final String LANG_OBJ_PROP = "objProp";
public static final String LANG_DATA_PROP = "dataProp";
public static final String LANG_EXT_PROP = "extProp";
public static final String LANG_ANN_PROP = "annProp";
public static final String LANG_NAMED_INDIV = "namedIndiv";
public static final String LANG_TABLE_OF_CONTENTS = "tableOfContents";
Expand Down Expand Up @@ -732,16 +734,11 @@ public static String getIndexDocument(String resourcesFolderName, Configuration
String document = OPENING;
/* Style selection */
if (c.isUseW3CStyle()) {
document += " <link rel=\"stylesheet\" href=\"" + resourcesFolderName
+ "/primer.css\" media=\"screen\" /> \n" +
" <link rel=\"stylesheet\" href=\"" + resourcesFolderName
+ "/rec.css\" media=\"screen\" /> \n" + " <link rel=\"stylesheet\" href=\"" + resourcesFolderName
+ "/extra.css\" media=\"screen\" /> \n" + " <link rel=\"stylesheet\" href=\"" + resourcesFolderName
+ "/owl.css\" media=\"screen\" /> \n";
document += getW3CStyleDoc(resourcesFolderName);

} else {
document += " <link rel=\"stylesheet\" href=\"" + resourcesFolderName + "/yeti.css\" media=\"screen\" /> \n"
+ " <link rel=\"stylesheet\" href=\"" + resourcesFolderName + "/site.css\" media=\"screen\" />\n";
document += htmlStyleSheet(resourcesFolderName+"/yeti.css","screen")
+htmlStyleSheet(resourcesFolderName+"/site.css","screen");
}
// add a favicon (rdf logo)
document += "<link rel=\"icon\" type=\"image/png\" href=\"" + resourcesFolderName + "/rdf.icon\"/>";
Expand Down Expand Up @@ -862,7 +859,25 @@ public static String getIndexDocument(String resourcesFolderName, Configuration

return document;
}


private static String htmlStyleSheet(String resource,String media) {
return "<link rel=\"stylesheet\" href=\""+ resource+"\" media=\""+media+"\"/>\n";
}

private static String getW3CStyleDoc(String rsrcFolder){
return htmlStyleSheet(rsrcFolder+"/primer.css","screen")
+ htmlStyleSheet(rsrcFolder+"/rec.css","screen")
+ htmlStyleSheet(rsrcFolder+"/extra.css","screen")
+ htmlStyleSheet(rsrcFolder+"/owl.css","screen")
+ htmlStyleSheet(rsrcFolder+"/dark.css","(prefers-color-scheme: dark)")
+ htmlStyleSheet(rsrcFolder+"/light.css","(prefers-color-scheme: light)")
+ htmlStyleSheet(rsrcFolder+"/slider.css","screen")
+ "<meta name=\"color-scheme\" content=\"dark light\">\n"
+ "<script type=\"module\" src=\"resources/dark-mode-toggle.mjs\"></script>"
+"<div class=\"darkmode\">\n"
+"\t<dark-mode-toggle class=\"slider\"></dark-mode-toggle>\n"
+"</div>\n";
}
/**
* Function that includes all the sections as part of the index document.
* This makes the documentation more difficult to edit, but simpler for production
Expand All @@ -884,14 +899,11 @@ public static String getUnifiedIndexDocument(String resourcesFolderName, Configu
String document = OPENING;
/* Style selection */
if (c.isUseW3CStyle()) {
document += " <link rel=\"stylesheet\" href=\"" + resourcesFolderName
+ "/primer.css\" media=\"screen\" /> " + " <link rel=\"stylesheet\" href=\"" + resourcesFolderName
+ "/rec.css\" media=\"screen\" /> " + " <link rel=\"stylesheet\" href=\"" + resourcesFolderName
+ "/extra.css\" media=\"screen\" /> " + " <link rel=\"stylesheet\" href=\"" + resourcesFolderName
+ "/owl.css\" media=\"screen\" /> ";
document += getW3CStyleDoc(resourcesFolderName);

} else {
document += " <link rel=\"stylesheet\" href=\"" + resourcesFolderName + "/yeti.css\" media=\"screen\" /> "
+ " <link rel=\"stylesheet\" href=\"" + resourcesFolderName + "/site.css\" media=\"screen\" />";
document += htmlStyleSheet(resourcesFolderName+"/yeti.css","screen")
+htmlStyleSheet(resourcesFolderName+"/site.css","screen");
}
// add a title to the document
if (c.getMainOntology().getTitle() != null && !"".equals(c.getMainOntology().getTitle()))
Expand Down Expand Up @@ -1500,25 +1512,30 @@ public static String getLegend(
+ " <span class=\"backlink\"> " + lang.getProperty(Constants.LANG_BACK)
+ " <a href=\"#toc\">ToC</a></span></h2>\n"
+ "<div class=\"entity\">\n"
+ (includesClass ?
+ (includesClass || ExternalPropertyParser.hasClasses()?
"<sup class=\"type-c\" title=\""
+ lang.getProperty(Constants.LANG_CLASSES)
+ "\">c</sup>: " + lang.getProperty(Constants.LANG_CLASSES) + " <br/>\n"
: "")
+ (includesProperty ?
+ (includesProperty || ExternalPropertyParser.hasObjProps()?
"<sup class=\"type-op\" title=\""
+ lang.getProperty(Constants.LANG_OBJ_PROP) + "\">op</sup>: "
+ lang.getProperty(Constants.LANG_OBJ_PROP) + " <br/>\n"
: "")
+ (includesDatatypeProperty ?
+ (includesDatatypeProperty || ExternalPropertyParser.hasDataProps()?
"<sup class=\"type-dp\" title=\""
+ lang.getProperty(Constants.LANG_DATA_PROP) + "\">dp</sup>: "
+ lang.getProperty(Constants.LANG_DATA_PROP) + " <br/>\n"
: "")
+ (includesNamedIndividual ?
+ (includesNamedIndividual || ExternalPropertyParser.hasNamedIndiv() ?
"<sup class=\"type-ni\" title=\""
+ lang.getProperty(Constants.LANG_NAMED_INDIV) + "\">ni</sup>: "
+ lang.getProperty(Constants.LANG_NAMED_INDIV) + "\n"
+ lang.getProperty(Constants.LANG_NAMED_INDIV) + " <br/>\n"
: "")
+ (ExternalPropertyParser.hasExternalProps() ?
"<sup class=\"type-ep\" title=\""
+ lang.getProperty(Constants.LANG_EXT_PROP) + "\">ep</sup>: "
+ lang.getProperty(Constants.LANG_EXT_PROP) + "\n"
: "")
+ "</div>\n" + "</div>"
+ "\n";
Expand Down
Loading

0 comments on commit 5e524f6

Please sign in to comment.