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 May 28, 2017
2 parents 978b65f + 6b93ef5 commit 5629bf8
Show file tree
Hide file tree
Showing 25 changed files with 762 additions and 429 deletions.
64 changes: 32 additions & 32 deletions doc/bestPractices/sections/checklist-en.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/bestPractices/sections/introduction-en.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h3 id="conv" class="list">Conventions</h3>


<div id="summary">
<h3 id="conv" class="list">Properties summary</h3>
<h2 id="conv" class="list">Properties summary</h2>
<p>A summary of the recommended and optional terms for the <a href="#desc">vocabulary description</a> (e.g., title, creator, etc.) and for <a href="#desc-term">classes and properties</a> description (e.g., label, definition, etc.) can be seen in the tables below:</p>

Summary of <em class="rfc2119" title="RECOMMENDED">RECOMMENDED</em> properties for <strong>vocabularies</strong>
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/diagram/DiagramGeneration.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
package diagram;

import static com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler.logger;
import de.uni_stuttgart.vis.vowl.owl2vowl.Owl2Vowl;
import java.io.File;
import widoco.Configuration;
Expand All @@ -25,8 +24,7 @@ public static void generateOntologyDiagram(String outFolder, Configuration c){
// converter.convert();
// converter.export(new FileExporter(new File(outFolder+File.separator+"webvowl"+File.separator+"data"+File.separator+"ontology.json")));
} catch (Exception e) {
logger.error("FAILED TO LOAD " + e.getMessage());
System.err.println(e.getMessage());
System.err.println("FAILED TO LOAD " + e.getMessage());
}
}

Expand Down
21 changes: 6 additions & 15 deletions src/main/java/diff/CompareOntologies.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,20 @@ public class CompareOntologies {
/**
* @param oldOntologyLocation location of the first ontology to be compared (the older ontology in most cases)
* @param c Configuration where the information of the current ontology is loaded
* @throws java.lang.Exception if the ontology could not be loaded
*/
public CompareOntologies(String oldOntologyLocation, Configuration c) {
public CompareOntologies(String oldOntologyLocation, Configuration c) throws Exception {
//Create 2 OWLOntologyManager which manages a set of ontologies
OWLOntologyManager manager1 = OWLManager.createOWLOntologyManager();
OWLOntology ontology1;

try {
ontology1= manager1.loadOntologyFromOntologyDocument(new File(oldOntologyLocation));
System.out.println("old ontology version loaded");
doFindAllChanges(ontology1, c.getMainOntology().getOWLAPIModel());
} catch (Exception e) {
System.err.println("Error while loading the first ontology");
return;
System.err.println("Error while loading the older version of the ontology");
throw e;
}
System.out.println("loading ontology 1 complete");

// try {
// ontology2= manager2.loadOntologyFromOntologyDocument(new File(ontology2Location));
// } catch (Exception e) {
// System.err.println("Error while loading the second ontology");
// return;
// }
// System.out.println("loading ontology 2 complete");

this.doFindAllChanges(ontology1, c.getMainOntology().getOWLAPIModel());
}


Expand Down
4 changes: 1 addition & 3 deletions src/main/java/lode/LODEGeneration.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.semanticweb.owlapi.formats.OWLXMLDocumentFormat;
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat;
import org.semanticweb.owlapi.io.OWLOntologyDocumentTarget;
import org.semanticweb.owlapi.io.RDFXMLOntologyFormat;
import org.semanticweb.owlapi.io.StringDocumentTarget;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
Expand Down Expand Up @@ -111,7 +109,7 @@ private static String parseImports(
}
}
OWLOntologyDocumentTarget parsedOntology = new StringDocumentTarget();
manager.saveOntology(ontology,new RDFXMLDocumentFormat(), parsedOntology);//new RDFXMLOntologyFormat()
manager.saveOntology(ontology,new RDFXMLDocumentFormat(), parsedOntology);
result = parsedOntology.toString();
// }

Expand Down
453 changes: 328 additions & 125 deletions src/main/java/widoco/Configuration.java

Large diffs are not rendered by default.

94 changes: 88 additions & 6 deletions src/main/java/widoco/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,91 @@ public class Constants {

public static final String[] POSSIBLE_VOCAB_SERIALIZATIONS = {"application/rdf+xml","text/turtle","text/n3"};

public static final String VOWL_LOGS = "owl2vowl_logs";
//this is left because in the json-ld schema there must be an image url.
public static final String WEBVOWL_SERVICE="http://vowl.visualdataweb.org/webvowl/#iri=";

/**
* Constants for loading metadata properties from the ontology
*/

public static final String NS_RDFS = "http://www.w3.org/2000/01/rdf-schema#";
public static final String NS_SCHEMA = "http://schema.org/";
public static final String NS_DC = "http://purl.org/dc/elements/1.1/";
public static final String NS_DCTERMS = "http://purl.org/dc/terms/";
public static final String NS_OWL = "http://www.w3.org/2002/07/owl#";
public static final String NS_VANN = "http://purl.org/vocab/vann/";
// public static final String NS_VAEM = "http://www.linkedmodel.org/schema/vaem#";
public static final String NS_PROV = "http://www.w3.org/ns/prov#";
public static final String NS_BIBO = "http://purl.org/ontology/bibo/";
public static final String NS_SKOS = "http://www.w3.org/2004/02/skos/core#";
public static final String NS_PAV = "http://purl.org/pav/";

public static final String PROP_RDFS_LABEL = NS_RDFS+"label";
public static final String PROP_RDFS_COMMENT = NS_RDFS+"comment";

public static final String PROP_SCHEMA_NAME = NS_SCHEMA+"name";
public static final String PROP_SCHEMA_CREATOR = NS_SCHEMA+"creator";
public static final String PROP_SCHEMA_LICENSE = NS_SCHEMA+"license";
public static final String PROP_SCHEMA_CONTRIBUTOR = NS_SCHEMA+"contributor";
public static final String PROP_SCHEMA_DESCRIPTION = NS_SCHEMA+"description";
public static final String PROP_SCHEMA_CITATION = NS_SCHEMA+"citation";
public static final String PROP_SCHEMA_DATE_CREATED = NS_SCHEMA+"dateCreated";
public static final String PROP_SCHEMA_DATE_MODIFIED = NS_SCHEMA+"dateModified";
public static final String PROP_SCHEMA_PUBLISER = NS_SCHEMA+"publisher";
public static final String PROP_SCHEMA_SCHEMA_VERSION = NS_SCHEMA+"schemaVersion";

public static final String PROP_OWL_VERSION_INFO = NS_OWL+"versionInfo";
public static final String PROP_OWL_PRIOR_VERSION = NS_OWL+"priorVersion";
public static final String PROP_OWL_BACKWARDS_COMPATIBLE = NS_OWL+"backwardCompatibleWith";

public static final String PROP_DC_TITLE = NS_DC+"title";
public static final String PROP_DC_RIGHTS = NS_DC+"rights";
public static final String PROP_DC_ABSTRACT = NS_DC+"abstract";
public static final String PROP_DC_DESCRIPTION = NS_DC+"description";
public static final String PROP_DC_CREATOR = NS_DC+"creator";
public static final String PROP_DC_REPLACES = NS_DC+"replaces";
public static final String PROP_DC_CONTRIBUTOR = NS_DC+"contributor";
public static final String PROP_DC_PUBLISHER = NS_DC+"publisher";

public static final String PROP_DCTERMS_REPLACES = NS_DCTERMS+"replaces";
public static final String PROP_DCTERMS_DESCRIPTION = NS_DCTERMS+"description";
public static final String PROP_DCTERMS_LICENSE = NS_DCTERMS+"license";
public static final String PROP_DCTERMS_TITLE = NS_DCTERMS+"title";
public static final String PROP_DCTERMS_ABSTRACT = NS_DCTERMS+"abstract";
public static final String PROP_DCTERMS_CREATOR = NS_DCTERMS+"creator";
public static final String PROP_DCTERMS_CONTRIBUTOR = NS_DCTERMS+"contributor";
public static final String PROP_DCTERMS_PUBLISHER = NS_DCTERMS+"publisher";
public static final String PROP_DCTERMS_CREATED = NS_DCTERMS+"created";
public static final String PROP_DCTERMS_MODIFIED = NS_DCTERMS+"modified";
public static final String PROP_DCTERMS_BIBLIOGRAPHIC_CIT = NS_DCTERMS+"bibliographicCitation";

public static final String PROP_BIBO_DOI = NS_BIBO+"doi";
public static final String PROP_BIBO_STATUS = NS_BIBO+"status";

public static final String PROP_PROV_WAS_REVISION_OF = NS_PROV+"wasRevisionOf";
public static final String PROP_PROV_GENERATED_AT_TIME = NS_PROV+"generatedAtTime";
public static final String PROP_PROV_ATTRIBUTED_TO = NS_PROV+"wasAttributedTo";//attribution only considered for authors

public static final String PROP_VANN_PREFIX= NS_VANN+"preferredNamespacePrefix";
public static final String PROP_VANN_URI= NS_VANN+"preferredNamespaceURI";

public static final String PROP_SKOS_NOTE= NS_SKOS+"note";

public static final String PROP_PAV_CREATED_BY = NS_PAV+"createdBy";
public static final String PROP_PAV_CREATED_ON = NS_PAV+"createdOn";
//public static final String PROP_PAV_CURRENT_VERSION = NS_PAV+"hasCurrentVersion";//we just extract the URI as the latest
public static final String PROP_PAV_PREVIOUS_VERSION = NS_PAV+"previousVersion";
public static final String PROP_PAV_CONTRIBUTED_BY = NS_PAV+"contributedBy";

public static final String PROP_CC_LICENSE = "http://creativecommons.org/ns#license";

//The following properties need additional support (future release)
//SEE_ALSO (NEEDED INTERFACE UPDATE)
//OWL:incompatibleWith
//foaf: logo schema:logo, foaf:depiction, schema:image
//issue date
//source for the vocab

/**
* Constants for the property file with the ontology metadata
*/
Expand Down Expand Up @@ -174,13 +255,14 @@ public class Constants {


public static String getAbstractSection(String abstractContent, Configuration c, Properties langFile){
String abstractSection = "<h2>"+langFile.getProperty(LANG_ABSTRACT)+"</h2><p>";
String abstractSection = "<h2>"+langFile.getProperty(LANG_ABSTRACT)+"</h2><span class=\"markdown\">\n";
if(abstractContent!=null && !"".equals(abstractContent)){
abstractSection+=abstractContent;
}
else{
abstractSection+=langFile.getProperty(LANG_ABSTRACT_PLACEHOLDER);
}
abstractSection+="</span>\n";
return abstractSection;
}

Expand All @@ -199,7 +281,7 @@ public static String getStatus(Configuration c){
return html;
}

public static String getIntroductionSection(Configuration c, Properties lang){
public static String getIntroductionSectionTitleAndPlaceHolder(Configuration c, Properties lang){
String s = "<h2 id=\"intro\" class=\"list\">"+lang.getProperty(LANG_INTRO_PLACEHODER);
return s;
}
Expand Down Expand Up @@ -605,15 +687,15 @@ public static String getHeadSection(Configuration c, Properties l){
return head;
}

public static String getOverviewSection(Configuration c, Properties lang){
public static String getOverviewSectionTitleAndPlaceHolder(Configuration c, Properties lang){
return "<h2 id=\"overv\" class=\"list\">"+c.getMainOntology().getName()+": "+lang.getProperty(LANG_OVERVIEW_PLACEHOLDER);
}

public static String getDescriptionSection(Configuration c, Properties lang){
public static String getDescriptionSectionTitleAndPlaceHolder(Configuration c, Properties lang){
return "<h2 id=\"desc\" class=\"list\">"+c.getMainOntology().getName()+": "+lang.getProperty(LANG_DESCRIPTION_PLACEHOLDER);
}

public static String getCrossReferenceSection(Configuration c, Properties lang){
public static String getCrossReferenceSectionTitleAndPlaceHolder(Configuration c, Properties lang){
return "<h2 id=\"crossreference\" class=\"list\">"+lang.getProperty(LANG_CROSS_REF_TITLE)+" "+c.getMainOntology().getName()+" "+lang.getProperty(LANG_CROSS_REF_TITLE2)+"</h2>"+"\n" +
lang.getProperty(LANG_CROSS_REF_PLACEHOLDER)+c.getMainOntology().getName()+".\n";
}
Expand Down
53 changes: 20 additions & 33 deletions src/main/java/widoco/CreateResources.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import javax.swing.JOptionPane;
import lode.LODEGeneration;
import org.semanticweb.owlapi.formats.N3DocumentFormat;
import org.semanticweb.owlapi.formats.NTriplesDocumentFormat;
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat;
import org.semanticweb.owlapi.formats.TurtleDocumentFormat;
import org.semanticweb.owlapi.model.OWLOntology;
Expand Down Expand Up @@ -104,34 +105,16 @@ public static void generateDocumentation(String outFolder, Configuration c, File
System.out.println("No previous version provided. No changelog produced!");
}
}
//diagram creation
DiagramGeneration.generateOntologyDiagram(folderOut, c);

if(c.isCreateWebVowlVisualization()){
DiagramGeneration.generateOntologyDiagram(folderOut, c);
}

//serialize the model in different serializations.
OWLOntologyManager om = c.getMainOntology().getOWLAPIOntologyManager();
OWLOntology o = c.getMainOntology().getOWLAPIModel();
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 N3DocumentFormat(), folderOut+File.separator+"ontology.n3");

// HashMap<String,String> s = c.getMainOntology().getSerializations();
// for(String serialization:s.keySet()){
// OutputStream out = null;
// String sValue = s.get(serialization);
// if(sValue.startsWith("ontology")){
// try {
// out = new FileOutputStream(folderOut+File.separator+sValue);
// //c.getMainOntology().getMainModel().write(out,serialization);
// c.getMainOntology().getOWLAPIOntologyManager().saveOntology(c.getMainOntology().getOWLAPIModel(), owldf, out);
// out.close();
// } catch (Exception ex) {
// System.out.println("Error while writing the model to file "+ex.getMessage());
// if(out!=null){
// out.close();
// }
// }
// }
// }
WidocoUtils.writeModel(om, o, new NTriplesDocumentFormat(), folderOut+File.separator+"ontology.nt");
if(c.isIncludeIndex()){
createIndexDocument(folderOut,c, lode, languageFile);
}
Expand Down Expand Up @@ -212,7 +195,7 @@ private static void createIntroductionSection(String path, HashMap<String,String
if((c.getIntroductionPath()!=null) && (!"".equals(c.getIntroductionPath()))){
WidocoUtils.copyExternalResource(c.getIntroductionPath(),new File(path+File.separator+"introduction-"+c.getCurrentLanguage()+".html"));
}else{
String introSectionText = Constants.getIntroductionSection(c, lang);
String introSectionText = Constants.getIntroductionSectionTitleAndPlaceHolder(c, lang);
if(nsDecl!=null && !nsDecl.isEmpty()){
introSectionText += Constants.getNameSpaceDeclaration(nsDecl, lang);
//small fix: use prefix selected by user.
Expand All @@ -229,7 +212,7 @@ private static void createOverviewSection(String path, Configuration c, String c
if((c.getOverviewPath()!=null) && (!"".equals(c.getOverviewPath()))){
WidocoUtils.copyExternalResource(c.getOverviewPath(), new File(path+File.separator+"overview-"+c.getCurrentLanguage()+".html"));
}else{
String overViewSection = Constants.getOverviewSection(c, lang);
String overViewSection = Constants.getOverviewSectionTitleAndPlaceHolder(c, lang);
if(!"".equals(classesList) && classesList!=null){
overViewSection+=("<h4>"+lang.getProperty(Constants.LANG_CLASSES)+"</h4>\n");
overViewSection+=(classesList);
Expand All @@ -250,8 +233,10 @@ private static void createOverviewSection(String path, Configuration c, String c
overViewSection+=("<h4>"+lang.getProperty(Constants.LANG_NAMED_INDIV)+"</h4>");
overViewSection+=(namedIndividuals);
}
//add the webvowl diagram
overViewSection +="<iframe align=\"center\" width=\"100%\" height =\"500px\" src=\"webvowl/index.html#ontology\"></iframe> ";
//add the webvowl diagram, if selected
if(c.isCreateWebVowlVisualization()){
overViewSection +="<iframe align=\"center\" width=\"100%\" height =\"500px\" src=\"webvowl/index.html#ontology\"></iframe> ";
}
saveDocument(path+File.separator+"overview-"+c.getCurrentLanguage()+".html", overViewSection,c);
}
}
Expand All @@ -260,13 +245,13 @@ private static void createDescriptionSection(String path, Configuration c, Prope
if((c.getDescriptionPath()!=null) && (!"".equals(c.getDescriptionPath()))){
WidocoUtils.copyExternalResource(c.getDescriptionPath(), new File(path+File.separator+"description-"+c.getCurrentLanguage()+".html"));
}else{
saveDocument(path+File.separator+"description-"+c.getCurrentLanguage()+".html",Constants.getDescriptionSection(c,lang),c);
saveDocument(path+File.separator+"description-"+c.getCurrentLanguage()+".html",Constants.getDescriptionSectionTitleAndPlaceHolder(c,lang),c);
}
}

private static void createCrossReferenceSection(String path,LODEParser lodeParser, Configuration c, Properties lang){
//cross reference section has to be included always.
String crossRef = Constants.getCrossReferenceSection(c, lang);
String crossRef = Constants.getCrossReferenceSectionTitleAndPlaceHolder(c, lang);
String classesList = lodeParser.getClassList(),propList = lodeParser.getPropertyList(), dataPropList = lodeParser.getDataPropList(),
annotationPropList = lodeParser.getAnnotationPropList(), namedIndividualList = lodeParser.getNamedIndividualList();
if(classesList!=null && !"".equals(classesList)){
Expand Down Expand Up @@ -340,7 +325,6 @@ private static void createFolderStructure(String s, Configuration c, Properties
File img = new File(s+File.separator+"img");
File provenance = new File(s+File.separator+"provenance");
File resources = new File(s+File.separator+"resources");
File webvowl = new File(s+File.separator+"webvowl");
if(!f.exists()){
f.mkdirs();
}else{
Expand All @@ -356,7 +340,6 @@ private static void createFolderStructure(String s, Configuration c, Properties
//do all provenance related stuff here
}
resources.mkdir();
webvowl.mkdir();
//copy jquery
WidocoUtils.copyLocalResource("/lode/jquery.js",new File(resources.getAbsolutePath()+File.separator+"jquery.js"));
WidocoUtils.copyLocalResource("/lode/marked.min.js",new File(resources.getAbsolutePath()+File.separator+"marked.min.js"));
Expand All @@ -370,13 +353,17 @@ private static void createFolderStructure(String s, Configuration c, Properties
WidocoUtils.copyLocalResource("/lode/bootstrap-yeti.css", new File(resources.getAbsolutePath()+File.separator+"yeti.css"));
WidocoUtils.copyLocalResource("/lode/site.css", new File(resources.getAbsolutePath()+File.separator+"site.css"));
}
//diagram information
WidocoUtils.unZipIt(Constants.WEBVOWL_RESOURCES, webvowl.getAbsolutePath());
//copy widoco readme
WidocoUtils.copyLocalResource("/widoco/readme.md", new File(f.getAbsolutePath()+File.separator+"readme.md"));
if(c.isCreateHTACCESS()){
create406Page(s+File.separator+"406.html",c,lang);
}
//diagram information
if(c.isCreateWebVowlVisualization()){
File webvowl = new File(s+File.separator+"webvowl");
webvowl.mkdir();
WidocoUtils.unZipIt(Constants.WEBVOWL_RESOURCES, webvowl.getAbsolutePath());
}
}


Expand Down
Loading

0 comments on commit 5629bf8

Please sign in to comment.