Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarijo committed Apr 16, 2018
2 parents b86deb9 + 8c64cab commit 2e9ad1f
Show file tree
Hide file tree
Showing 14 changed files with 544 additions and 87 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WIzard for DOCumenting Ontologies (WIDOCO)

**Author**: Daniel Garijo Verdejo

**Contributors**: María Poveda, Idafen Santana, Almudena Ruiz, Miguel Angel García, Oscar Corcho, Daniel Vila and Sergio Barrio.
**Contributors**: María Poveda, Idafen Santana, Almudena Ruiz, Miguel Angel García, Oscar Corcho, Daniel Vila, Sergio Barrio, Martin Scharm, Maxime Lefrancois.

**Citing WIDOCO**: Please cite the latest version of WIDOCO in Zenodo: https://zenodo.org/badge/latestdoi/11427075.
Also see our ISWC 2017 paper: https://iswc2017.semanticweb.org/paper-138
Expand Down Expand Up @@ -71,6 +71,8 @@ The `-licensius` flag uses the Licensius web services (http://licensius.com/apid

The `-ignoreIndividuals` allows you to ignore the named individuals in the ontology.

The `-includeAnnotationProperties` will include annotation properties defined in your ontology (by default they are not included)

How can I make WIDOCO automatically recognize my vocabulary annotations?
==========
There are two ways for making WIDOCO get your vocabulary metadata annotations and use them automatically to document the ontology.
Expand Down
90 changes: 50 additions & 40 deletions src/main/java/widoco/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ public final void initializeConfig(){
includeIndex = true;
includeChangeLog = true;
if(languages==null){
currentLanguage = "en";
languages = new HashMap<String, Boolean>();
languages.put("en", false);
}
currentLanguage = "en";
languages.put("en", false);
useW3CStyle = true;//by default
error = "";
addImportedOntologies = false;
Expand Down Expand Up @@ -199,10 +199,11 @@ private void initializeOntology(){
License l = new License();
mainOntologyMetadata.setLicense(l);
mainOntologyMetadata.setSerializations(new HashMap<String, String>());
//add default serializations: rdf/xml, n3 and turtle
//add default serializations: rdf/xml, n3, turtle and json-ld
mainOntologyMetadata.addSerialization("RDF/XML", "ontology.xml");
mainOntologyMetadata.addSerialization("TTL", "ontology.ttl");
mainOntologyMetadata.addSerialization("N-Triples", "ontology.nt");
mainOntologyMetadata.addSerialization("JSON-LD", "ontology.json");
mainOntologyMetadata.setCreators(new ArrayList<Agent>());
mainOntologyMetadata.setContributors(new ArrayList<Agent>());
mainOntologyMetadata.setCiteAs("");
Expand Down Expand Up @@ -385,7 +386,8 @@ public void loadPropertiesFromOntology(OWLOntology o){
//get name, get URI, add to the config
Ontology ont = new Ontology();
ont.setNamespaceURI(i.getOntologyID().getOntologyIRI().get().toString());
ont.setName(i.getOntologyID().getOntologyIRI().get().getShortForm());
ont.setName(i.getOntologyID().getOntologyIRI().get().getShortForm().replace("<", "&lt;").replace(">", "&gt;"));
//added replacements so they will be shown in html
mainOntologyMetadata.getImportedOntologies().add(ont);
});
this.mainOntologyMetadata.setThisVersion(versionUri);
Expand Down Expand Up @@ -479,49 +481,57 @@ private void completeMetadata(OWLAnnotation a){
mainOntologyMetadata.setNamespaceURI(value);
break;
case Constants.PROP_DCTERMS_LICENSE: case Constants.PROP_DC_RIGHTS:
case Constants.PROP_SCHEMA_LICENSE: case Constants.PROP_CC_LICENSE:
value = WidocoUtils.getValueAsLiteralOrURI(a.getValue());
License l = new License();
if(isURL(value)){
l.setUrl(value);
l.setName(value);
}else{
l.setName(value);
case Constants.PROP_SCHEMA_LICENSE: case Constants.PROP_CC_LICENSE:
try{
value = WidocoUtils.getValueAsLiteralOrURI(a.getValue());
License l = new License();
if(isURL(value)){
l.setUrl(value);
l.setName(value);
}else{
l.setName(value);
}
mainOntologyMetadata.setLicense(l);
}catch(Exception e){
System.err.println("Could not retrieve license. Please avoid using blank nodes...");
}
mainOntologyMetadata.setLicense(l);
break;
case Constants.PROP_DC_CONTRIBUTOR: case Constants.PROP_DCTERMS_CONTRIBUTOR:
case Constants.PROP_SCHEMA_CONTRIBUTOR: case Constants.PROP_PAV_CONTRIBUTED_BY:
case Constants.PROP_DC_CREATOR: case Constants.PROP_DCTERMS_CREATOR: case Constants.PROP_SCHEMA_CREATOR:
case Constants.PROP_PAV_CREATED_BY: case Constants.PROP_PROV_ATTRIBUTED_TO:
case Constants.PROP_DC_PUBLISHER: case Constants.PROP_DCTERMS_PUBLISHER:
case Constants.PROP_SCHEMA_PUBLISER:
value = WidocoUtils.getValueAsLiteralOrURI(a.getValue());
Agent g = new Agent();
if(isURL(value)){
g.setURL(value);
g.setName(value);
}else{
g.setName(value);
g.setURL("");
}
switch (propertyName) {
case Constants.PROP_DC_CONTRIBUTOR: case Constants.PROP_DCTERMS_CONTRIBUTOR:
case Constants.PROP_SCHEMA_CONTRIBUTOR: case Constants.PROP_PAV_CONTRIBUTED_BY:
mainOntologyMetadata.getContributors().add(g);
break;
case Constants.PROP_DC_CREATOR: case Constants.PROP_DCTERMS_CREATOR:
case Constants.PROP_PAV_CREATED_BY: case Constants.PROP_PROV_ATTRIBUTED_TO:
case Constants.PROP_SCHEMA_CREATOR:
mainOntologyMetadata.getCreators().add(g);
break;
default:
mainOntologyMetadata.setPublisher(g);
break;
case Constants.PROP_DC_CREATOR: case Constants.PROP_DCTERMS_CREATOR: case Constants.PROP_SCHEMA_CREATOR:
case Constants.PROP_PAV_CREATED_BY: case Constants.PROP_PROV_ATTRIBUTED_TO:
case Constants.PROP_DC_PUBLISHER: case Constants.PROP_DCTERMS_PUBLISHER:
case Constants.PROP_SCHEMA_PUBLISER:
try{
value = WidocoUtils.getValueAsLiteralOrURI(a.getValue());
Agent g = new Agent();
if(isURL(value)){
g.setURL(value);
g.setName(value);
}else{
g.setName(value);
g.setURL("");
}
switch (propertyName) {
case Constants.PROP_DC_CONTRIBUTOR: case Constants.PROP_DCTERMS_CONTRIBUTOR:
case Constants.PROP_SCHEMA_CONTRIBUTOR: case Constants.PROP_PAV_CONTRIBUTED_BY:
mainOntologyMetadata.getContributors().add(g);
break;
case Constants.PROP_DC_CREATOR: case Constants.PROP_DCTERMS_CREATOR:
case Constants.PROP_PAV_CREATED_BY: case Constants.PROP_PROV_ATTRIBUTED_TO:
case Constants.PROP_SCHEMA_CREATOR:
mainOntologyMetadata.getCreators().add(g);
break;
default:
mainOntologyMetadata.setPublisher(g);
break;
}
}catch(Exception e){
System.err.println("Could not retrieve cretor/contirbutor. Please avoid using blank nodes...");
}
break;
case Constants.PROP_DCTERMS_CREATED: case Constants.PROP_SCHEMA_DATE_CREATED:
case Constants.PROP_PROV_GENERATED_AT_TIME: case Constants.PROP_PAV_CREATED_ON:
case Constants.PROP_PROV_GENERATED_AT_TIME: case Constants.PROP_PAV_CREATED_ON:
if(mainOntologyMetadata.getReleaseDate()==null || "".equals(mainOntologyMetadata.getReleaseDate())){
value = a.getValue().asLiteral().get().getLiteral();
mainOntologyMetadata.setReleaseDate(value);
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/widoco/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ public static String getIndexDocument(String resourcesFolderName,Configuration c
if(c.getMainOntology().getTitle()!=null &&!"".equals(c.getMainOntology().getTitle()))
document += " <title>"+c.getMainOntology().getTitle()+"</title>\n";
else
document += " <title>Ontologies Documentation generated by WIDOCO</title>\n";
document += " <title>Ontology Documentation generated by WIDOCO</title>\n";



Expand Down Expand Up @@ -782,6 +782,8 @@ public static String getProvenanceRDF(Configuration c){
if(c.getMainOntology().getTitle()!=null &&!"".equals(c.getMainOntology().getTitle())){
provrdf+= "\t dc:title \""+c.getMainOntology().getTitle()+"\";\n";
}
String agents = "";
int i = 0;
if(!c.getMainOntology().getCreators().isEmpty()){
Iterator<Agent> creators = c.getMainOntology().getCreators().iterator();
while(creators.hasNext()){
Expand All @@ -791,7 +793,9 @@ public static String getProvenanceRDF(Configuration c){
provrdf+= "\t prov:wasAttributedTo <"+currCreator.getURL()+">;\n";
provrdf+= "\t dc:creator <"+currCreator.getURL()+">;\n";
}else{
provrdf+= "\t prov:wasAttributedTo [ a prov:Agent; foaf:name \""+currCreator.getName()+"\".];\n";
provrdf+= "\t prov:wasAttributedTo :agent"+i+";\n";//[ a prov:Agent; foaf:name \""+currCreator.getName()+"\".];\n";
agents +=":agent"+i+" a prov:Agent; foaf:name \""+currCreator.getName()+"\".\n";
i++;
}
}
}
Expand All @@ -803,7 +807,9 @@ public static String getProvenanceRDF(Configuration c){
provrdf+= "\t prov:wasAttributedTo <"+currContrib.getURL()+">;\n";
provrdf+= "\t dc:contributor <"+currContrib.getURL()+">;\n";
}else{
provrdf+= "\t prov:wasAttributedTo [ a prov:Agent; foaf:name \""+currContrib.getName()+"\".];\n";
provrdf+= "\t prov:wasAttributedTo :agent"+i+";\n";//[ a prov:Agent; foaf:name \""+currContrib.getName()+"\".];\n";
agents +=":agent"+i+" a prov:Agent; foaf:name \""+currContrib.getName()+"\".\n";
i++;
}
}
}
Expand All @@ -818,6 +824,7 @@ public static String getProvenanceRDF(Configuration c){
provrdf+="\t prov:wasGeneratedAt \""+c.getMainOntology().getReleaseDate()+"\";\n";
}
provrdf +=".\n";
provrdf += agents;
return provrdf;
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/widoco/CreateResources.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import lode.LODEGeneration;
import org.semanticweb.owlapi.formats.N3DocumentFormat;
import org.semanticweb.owlapi.formats.NTriplesDocumentFormat;
import org.semanticweb.owlapi.formats.RDFJsonLDDocumentFormat;
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat;
import org.semanticweb.owlapi.formats.TurtleDocumentFormat;
import org.semanticweb.owlapi.model.OWLOntology;
Expand All @@ -46,7 +47,7 @@
*/
public class CreateResources {

//to do: analyze if this is the right name for the class. Maybe "generate" is better

public static void generateDocumentation(String outFolder, Configuration c, File lodeResources) throws Exception{
String lodeContent;
String folderOut = outFolder;
Expand Down Expand Up @@ -115,6 +116,7 @@ public static void generateDocumentation(String outFolder, Configuration c, File
WidocoUtils.writeModel(om, o, new RDFXMLDocumentFormat(), folderOut+File.separator+"ontology.xml");
WidocoUtils.writeModel(om, o, new TurtleDocumentFormat(), folderOut+File.separator+"ontology.ttl");
WidocoUtils.writeModel(om, o, new NTriplesDocumentFormat(), folderOut+File.separator+"ontology.nt");
WidocoUtils.writeModel(om, o, new RDFJsonLDDocumentFormat(), folderOut+File.separator+"ontology.json");
if(c.isIncludeIndex()){
createIndexDocument(folderOut,c, lode, languageFile);
}
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/widoco/gui/GuiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public GuiController(String[] args){
String outFolder="myDocumentation"+(new Date().getTime()), ontology="", configOutFile=null;
boolean isFromFile=false, oops = false, rewriteAll=false, getOntoMetadata = true, useW3Cstyle = true,
includeImportedOntologies = false, htAccess = false, webVowl=false, errors = false, licensius = false,
generateOnlyCrossRef = false, includeNamedIndividuals=true;
generateOnlyCrossRef = false, includeNamedIndividuals=true, includeAnnotationProperties = false;
String confPath="";
String[] languages = null;
int i=0;
Expand Down Expand Up @@ -133,11 +133,13 @@ public GuiController(String[] args){
break;
case "-ignoreIndividuals":
includeNamedIndividuals=false;
i++;
break;
case "-includeAnnotationProperties":
includeAnnotationProperties = true;
break;
default:
System.out.println("Command"+s+" not recognized.");
System.out.println("Usage: java -jar widoco.jar [-ontFile file] or [-ontURI uri] [-outFolder folderName] [-confFile propertiesFile] [-getOntologyMetadata] [-oops] [-rewriteAll] [-crossRef] [-saveConfig configOutFile] [-lang lang1-lang2] [-includeImportedOntologies] [-htaccess] [-licensius] [-webVowl] [-ignoreIndividuals]\n");
System.out.println("Usage: java -jar widoco.jar [-ontFile file] or [-ontURI uri] [-outFolder folderName] [-confFile propertiesFile] [-getOntologyMetadata] [-oops] [-rewriteAll] [-crossRef] [-saveConfig configOutFile] [-lang lang1-lang2] [-includeImportedOntologies] [-htaccess] [-licensius] [-webVowl] [-ignoreIndividuals] [-includeAnnotationProperties]\n");
return;
}
i++;
Expand Down Expand Up @@ -171,6 +173,7 @@ public GuiController(String[] args){
this.config.setCreateWebVowlVisualization(webVowl);
this.config.setUseLicensius(licensius);
this.config.setIncludeNamedIndividuals(includeNamedIndividuals);
this.config.setIncludeAnnotationProperties(includeAnnotationProperties);
if(languages!=null){
config.removeLanguageToGenerate("en");//default
for (String language : languages) {
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/widoco/gui/SelectLanguage.form
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Languages..."/>
<Property name="alwaysOnTop" type="boolean" value="true"/>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
Expand Down Expand Up @@ -33,9 +34,9 @@
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="pt" min="-2" max="-2" attributes="0"/>
<Component id="en" min="-2" max="-2" attributes="0"/>
<Component id="fr" min="-2" max="-2" attributes="0"/>
<Component id="es" min="-2" max="-2" attributes="0"/>
<Component id="en" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="de" alignment="0" min="-2" max="-2" attributes="0"/>
Expand All @@ -53,7 +54,7 @@
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
<Component id="en" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="es" min="-2" max="-2" attributes="0"/>
Expand Down Expand Up @@ -97,37 +98,36 @@
</Component>
<Component class="javax.swing.JTextField" name="otherText">
</Component>
<Component class="javax.swing.JRadioButton" name="en">
<Component class="javax.swing.JRadioButton" name="it">
<Properties>
<Property name="text" type="java.lang.String" value="en (default)"/>
<Property name="text" type="java.lang.String" value="it (coming soon)"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="es">
<Component class="javax.swing.JRadioButton" name="de">
<Properties>
<Property name="text" type="java.lang.String" value="es"/>
<Property name="text" type="java.lang.String" value="de (coming soon)"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="it">
<Component class="javax.swing.JCheckBox" name="en">
<Properties>
<Property name="text" type="java.lang.String" value="it (coming soon)"/>
<Property name="enabled" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" value="en (default)"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="fr">
<Component class="javax.swing.JCheckBox" name="fr">
<Properties>
<Property name="text" type="java.lang.String" value="fr (coming soon)"/>
<Property name="enabled" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" value="fr"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="pt">
<Component class="javax.swing.JCheckBox" name="es">
<Properties>
<Property name="text" type="java.lang.String" value="pt"/>
<Property name="text" type="java.lang.String" value="es"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="de">
<Component class="javax.swing.JCheckBox" name="pt">
<Properties>
<Property name="text" type="java.lang.String" value="de (coming soon)"/>
<Property name="enabled" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" value="pt"/>
</Properties>
</Component>
</SubComponents>
Expand Down
Loading

0 comments on commit 2e9ad1f

Please sign in to comment.