diff --git a/README.md b/README.md index 04bc5ca..270ec41 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ The -licensius flag uses the Licensius web services (http://licensius.com/apidoc Browser problems ========== -The result of executing Widoco is an html file. We have tested it in Mozilla, IE and Chrome, and when the page is stored in a server all the browsers work correctly. If you view the file locally, we recommend you to use Mozilla Firefox (or Internet Explorer, if you must). Google Chrome will not show the contents correctly, as it doesn't allow XMLHttpRequest without HTTP. If you want to view the page locally with Google Chrome you have two possibilities: +The result of executing Widoco is an html file. We have tested it in Mozilla, IE and Chrome, and when the page is stored in a server all the browsers work correctly. If you view the file locally, we recommend you to use Mozilla Firefox or Safari (or Internet Explorer, if you must). Google Chrome will not show the contents correctly, as it doesn't allow XMLHttpRequest without HTTP. If you want to view the page locally with Google Chrome you have two possibilities: a) Place the file in a server and access it via its URL (for example, put it in dropbox and access through its public url). diff --git a/src/main/java/ar2dtool/readme.md b/src/main/java/ar2dtool/readme.md deleted file mode 100644 index 9fe8fe4..0000000 --- a/src/main/java/ar2dtool/readme.md +++ /dev/null @@ -1,2 +0,0 @@ -This folder will have the implementation of the ar2d tool, a tool that takes an ontology and produces a diagram from it. -TO DO: Import the tool, adapt it and invoke it. \ No newline at end of file diff --git a/src/main/java/diff/CompareOntologies.java b/src/main/java/diff/CompareOntologies.java new file mode 100644 index 0000000..6a396f1 --- /dev/null +++ b/src/main/java/diff/CompareOntologies.java @@ -0,0 +1,391 @@ +package diff; + +import java.io.File; +import java.util.*; + + +import org.semanticweb.owlapi.apibinding.OWLManager; +import org.semanticweb.owlapi.model.*; + + +/** + * @author James Malone + * @version 1.02 + * Use the CompareOntologies class and subsequent doFindAllChanges methods to invoke a diff + * between two ontologies. + * Diff results can be output to xml file using the writeDiffAsXMLFile method + * + * + * NOTICE: + * @author Daniel Garijo + * Code adapted to Widoco by Daniel Garijo (heavily changed) + * The changes made to the original bubastis code have been made so the original tool can be used + * within Widoco without having to invoke bubastis through the command line. They are summarized as follows: + * - Simplified the original code removing unused constructors. + * - Refined the changes among two classes (now it will return classes with different labels). + * - Added change tracking of properties and data properties. + * Original bubastis code has been obtained from: https://github.com/EBISPOT/bubastis + */ +public class CompareOntologies { + + //classes + private ArrayList modifiedClasses = new ArrayList(); + private ArrayList newClasses = new ArrayList(); + private ArrayList deletedClasses = new ArrayList(); + //properties + private ArrayList modifiedProperties = new ArrayList(); + private ArrayList newProperties = new ArrayList(); + private ArrayList deletedProperties = new ArrayList(); + //data properties + private ArrayList modifiedDataProperties = new ArrayList(); + private ArrayList newDataProperties = new ArrayList(); + private ArrayList deletedDataProperties = new ArrayList(); + + private String oldVersion, newVersion; + + public CompareOntologies(String ontology1Location, String ontology2Location) { + //Create 2 OWLOntologyManager which manages a set of ontologies + OWLOntologyManager manager1 = OWLManager.createOWLOntologyManager(); + OWLOntologyManager manager2 = OWLManager.createOWLOntologyManager(); + OWLOntology ontology1; + OWLOntology ontology2; + + try { + ontology1= manager1.loadOntologyFromOntologyDocument(new File(ontology1Location)); + } catch (Exception e) { + System.err.println("Error while loading the first ontology"); + return; + } + 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, ontology2); + } + + + /** + * Perform diff on two ontologies supplying the two OWLOntologyManager classes and + * the two OWLOntology classes which have the ontologies pre-loaded + * + * @param ont1 first ontology to be compared (the older ontology in most cases) + * @param ont2 second ontology to compare to ont1 (the newer ontology in most cases) + */ + private void doFindAllChanges(OWLOntology ont1, OWLOntology ont2) { + this.oldVersion = ont1.getOntologyID().getOntologyIRI().toString(); + this.newVersion = ont2.getOntologyID().getOntologyIRI().toString(); + + //this.modifiedClasses = compareAllClassAxioms(manager1, ont1, manager2, ont2); + this.modifiedClasses = compareAllClassAxioms(ont1, ont2); + this.newClasses = findNewClasses( ont1, ont2); + this.deletedClasses = findDeletedClasses(ont1, ont2); + + this.modifiedProperties = compareAllObjectPropertyAxioms(ont1,ont2); + this.newProperties = findNewProperties(ont1, ont2); + this.deletedProperties = findDeletedProperties(ont1, ont2); + + this.modifiedDataProperties = compareAllDataPropertyAxioms(ont1, ont2); + this.newDataProperties = findNewDataProperties(ont1, ont2); + this.deletedDataProperties = findDeletedDataProperties(ont1, ont2); + } + + + /** + * Method for walking through all the classes in a given ontology and + * comparing with classes in another given ontology and identifying + * differences in axioms between any two identical classes - identical here + * to mean having same class URI + * + * @param ont1 first ontology to be compared (the older ontology in most cases) + * @param ont2 second ontology to compare to ont1 (the newer ontology in most cases) + * @return all the axioms that have changed in a class. + */ + private ArrayList compareAllClassAxioms(OWLOntology ont1, OWLOntology ont2) { + + ArrayList classDifferences = new ArrayList(); + //get all classes from first ontology and walk through them + for (OWLClass ont1Class : ont1.getClassesInSignature()) { + //find the current class on the second ontology. Compare them. + if (ont2.containsClassInSignature(ont1Class.getIRI())) { + OWLAxiomInfo tempDiffs = this.getDifferences(ont1Class.getIRI(), + new HashSet(ont1.getAxioms(ont1Class)), + new HashSet(ont2.getAxioms(ont1Class))); + //differences in annotations + OWLAxiomInfo tempDiffs2 = this.getDifferences(ont1Class.getIRI(), + new HashSet(ont1Class.getAnnotationAssertionAxioms(ont1)), + new HashSet(ont1Class.getAnnotationAssertionAxioms(ont2))); + //merge sets. + tempDiffs.addDeleteChangeAxioms(tempDiffs2.getDeletedAxioms()); + tempDiffs.addNewChangeAxioms(tempDiffs2.getNewAxioms()); + if (!tempDiffs.isEmpty()){ + classDifferences.add(tempDiffs); + } + } + } + return classDifferences; + } + + /** + * Method designed to track the changes in the property axioms of the ontologies + * @param ont1 old version of the ontology + * @param ont2 new version of the ontology + * @return + */ + private ArrayList compareAllObjectPropertyAxioms(OWLOntology ont1, OWLOntology ont2) { + + ArrayList propertyDifferences = new ArrayList(); + //get all classes from first ontology and walk through them + for (OWLObjectProperty ont1Property : ont1.getObjectPropertiesInSignature()) { + //find the current class on the second ontology. Compare them. + if (ont2.containsObjectPropertyInSignature(ont1Property.getIRI())) { + OWLAxiomInfo tempDiffs = this.getDifferences(ont1Property.getIRI(), + new HashSet(ont1.getAxioms(ont1Property)), + new HashSet(ont2.getAxioms(ont1Property))); + //differences in annotations + OWLAxiomInfo tempDiffs2 = this.getDifferences(ont1Property.getIRI(), + new HashSet(ont1Property.getAnnotationAssertionAxioms(ont1)), + new HashSet(ont1Property.getAnnotationAssertionAxioms(ont2))); + //merge sets. + tempDiffs.addDeleteChangeAxioms(tempDiffs2.getDeletedAxioms()); + tempDiffs.addNewChangeAxioms(tempDiffs2.getNewAxioms()); + if (!tempDiffs.isEmpty()){ + propertyDifferences.add(tempDiffs); + } + } + } + return propertyDifferences; + } + + /** + * Method designed to track the changes in the data property axioms of the ontologies + * @param ont1 old version of the ontology + * @param ont2 new version of the ontology + * @return + */ + private ArrayList compareAllDataPropertyAxioms(OWLOntology ont1, OWLOntology ont2) { + + ArrayList propertyDifferences = new ArrayList(); + //get all classes from first ontology and walk through them + for (OWLDataProperty ont1Property : ont1.getDataPropertiesInSignature()) { + //find the current class on the second ontology. Compare them. + if (ont2.containsDataPropertyInSignature(ont1Property.getIRI())) { + OWLAxiomInfo tempDiffs = this.getDifferences(ont1Property.getIRI(), + new HashSet(ont1.getAxioms(ont1Property)), + new HashSet(ont2.getAxioms(ont1Property))); + //differences in annotations + OWLAxiomInfo tempDiffs2 = this.getDifferences(ont1Property.getIRI(), + new HashSet(ont1Property.getAnnotationAssertionAxioms(ont1)), + new HashSet(ont1Property.getAnnotationAssertionAxioms(ont2))); + //merge sets. + tempDiffs.addDeleteChangeAxioms(tempDiffs2.getDeletedAxioms()); + tempDiffs.addNewChangeAxioms(tempDiffs2.getNewAxioms()); + if (!tempDiffs.isEmpty()){ + propertyDifferences.add(tempDiffs); + } + } + } + return propertyDifferences; + } + + /** + * Method to get the different axioms between two sets. + * @param entity the entity we want to track on each set. + * @param setOnto1 the set of axioms on ontology 1 + * @param setOnto2 the set of axioms on ontology 2 + * @return + */ + private OWLAxiomInfo getDifferences(IRI entity, SetsetOnto1, SetsetOnto2){ + OWLAxiomInfo tempDiffs = new OWLAxiomInfo(entity, null, null); + if(!setOnto1.equals(setOnto2)){ + Set newChanges = new HashSet(setOnto2); + newChanges.removeAll(setOnto1); + + Set deletedChanges = new HashSet(setOnto1); + deletedChanges.removeAll(setOnto2); + + tempDiffs.addNewChangeAxioms(newChanges); + tempDiffs.addDeleteChangeAxioms(deletedChanges); + } + return tempDiffs; + } + + + /** + * method to find classes that have been deleted, that is classes that appear + * in ontology 1 but not in ontology 2. It chains to the findNewClasses and + * simply reverses the order, i.e. classes in ontology 1 but not in ontology 2 + * + * @param ont1 first ontology to be compared (the older ontology in most cases) + * @param ont2 second ontology to compare to ont1 (the newer ontology in most cases) + * @return axioms from deleted classes + */ + private ArrayList findDeletedClasses(OWLOntology ont1, OWLOntology ont2) { + + return findNewClasses(ont2, ont1); + + } + /** + * Method to find all the deleted properties, i.e., those that appear in ont2 and do not + * appear on on1 + * @param ont1 old version of the ontology + * @param ont2 new version of the ontology + * @return + */ + private ArrayList findDeletedProperties(OWLOntology ont1, OWLOntology ont2) { + + return findNewProperties(ont2, ont1); + + } + + /** + * Method to find all the deleted data properties, i.e., those that appear in ont2 and do not + * appear on on1 + * @param ont1 old version of the ontology + * @param ont2 new version of the ontology + * @return + */ + private ArrayList findDeletedDataProperties(OWLOntology ont1, OWLOntology ont2) { + + return findNewDataProperties(ont2, ont1); + + } + + + /** + * method to find classes that are 'new', that is classes that appear + * in ontology 2 but not in ontology 1 + * + * @param ont1 first ontology to be compared (the older ontology in most cases) + * @param ont2 second ontology to compare to ont1 (the newer ontology in most cases) + * @return + */ + private ArrayList findNewClasses(OWLOntology ont1, OWLOntology ont2) { + + ArrayList newC = new ArrayList(); + //get all classes from 2nd ontology and walk through them + for (OWLClass ont2Class : ont2.getClassesInSignature()) { + //if there is no reference in ontology 1 to the class in ontoloy 2 then it's new + if (!ont1.containsClassInSignature(ont2Class.getIRI())) { + Set newClassAxiomsSet = new HashSet(ont2.getAxioms(ont2Class)); + //create information for the new class + OWLAxiomInfo tempNewClass = new OWLAxiomInfo(ont2Class.getIRI(), newClassAxiomsSet,null); + newC.add(tempNewClass); + } + } + return newC; + + } + + /** + * Method to find properties that are new, i.e., that appear in ont2 but not in ont1 + * @param ont1 old version of the ontology + * @param ont2 new version of the ontology + * @return + */ + private ArrayList findNewProperties(OWLOntology ont1, OWLOntology ont2) { + ArrayList newC = new ArrayList(); + for (OWLObjectProperty ont2Prop : ont2.getObjectPropertiesInSignature()) { + if (!ont1.containsObjectPropertyInSignature(ont2Prop.getIRI())) { + Set newProprAxiomsSet = new HashSet(ont2.getAxioms(ont2Prop)); + OWLAxiomInfo tempNewProp = new OWLAxiomInfo(ont2Prop.getIRI(), newProprAxiomsSet,null); + newC.add(tempNewProp); + } + } + return newC; + } + + /** + * Method to find data properties that are new, i.e., that appear in ont2 but not in ont1 + * @param ont1 old version of the ontology + * @param ont2 new version of the ontology + * @return + */ + private ArrayList findNewDataProperties(OWLOntology ont1, OWLOntology ont2) { + ArrayList newC = new ArrayList(); + for (OWLDataProperty ont2Prop : ont2.getDataPropertiesInSignature()) { + if (!ont1.containsDataPropertyInSignature(ont2Prop.getIRI())) { + Set newDataProprAxiomsSet = new HashSet(ont2.getAxioms(ont2Prop)); + OWLAxiomInfo tempNewProp = new OWLAxiomInfo(ont2Prop.getIRI(), newDataProprAxiomsSet,null); + newC.add(tempNewProp); + } + } + return newC; + } + + + /** + * get method to retrieve information about all the classes with differences + * + * @return list of classes with information about differences + */ + public ArrayList getClassesWithDifferences() { + return modifiedClasses; + } + + + /** + * get method to retrieve information about all the classes that are new to second ontology + * + * @return list of classes with information about the classes new to the second ontology + */ + public ArrayList getNewClasses() { + return newClasses; + } + + /** + * Get all of the classes that have been deleted between versions + * + * @return the deletedClasses + */ + public ArrayList getDeletedClasses() { + return deletedClasses; + } + + public ArrayList getDeletedDataProperties() { + return deletedDataProperties; + } + + public ArrayList getDeletedProperties() { + return deletedProperties; + } + + public ArrayList getModifiedClasses() { + return modifiedClasses; + } + + public ArrayList getModifiedDataProperties() { + return modifiedDataProperties; + } + + public ArrayList getModifiedProperties() { + return modifiedProperties; + } + + public ArrayList getNewDataProperties() { + return newDataProperties; + } + + public ArrayList getNewProperties() { + return newProperties; + } + + public String getNewVersion() { + return newVersion; + } + + public String getOldVersion() { + return oldVersion; + } + + + + + + +} diff --git a/src/main/java/diff/OWLAxiomInfo.java b/src/main/java/diff/OWLAxiomInfo.java new file mode 100644 index 0000000..4eeb335 --- /dev/null +++ b/src/main/java/diff/OWLAxiomInfo.java @@ -0,0 +1,101 @@ +package diff; + +import java.util.HashSet; +import java.util.Set; + +import org.semanticweb.owlapi.model.*; + + +/* + * Helper class to store information on a class which can be + * used to store information about difference between two classes + * newClassAxiomsSet holds axioms that have been added to this class + * and deletedClassAxiomsSet holds axioms that have been removed compared with + * the same class in another ontology + */ + +/** + * @author Daniel Garijo + * This class has been modified by Daniel Garijo to make the axioms more general + * and capture changes in labels and comments or definitions (annotation properties) + * @author dgarijo + */ + + +public class OWLAxiomInfo { + + private final IRI classIRI; + private Set newAxiomSet; + private Set deletedAxiomSet; + + + + + //constructor + public OWLAxiomInfo(IRI classIRI, Set newClassAxiomsSet, + Set deletedClassAxiomsSet) { + this.classIRI = classIRI; + this.newAxiomSet = newClassAxiomsSet; + this.deletedAxiomSet = deletedClassAxiomsSet; + } + + + + + public IRI getIRI(){ + return classIRI; + } + + + //get method to return the new class axioms as Axioms + public Set getNewAxioms(){ + return newAxiomSet; + } + + /** + * Method to merge two collection of axioms to the new Changes Set + * @param newAxioms + */ + public void addNewChangeAxioms(Set newAxioms){ + if(this.newAxiomSet==null){ + this.newAxiomSet = new HashSet(); + } + if(newAxioms!= null && !newAxioms.isEmpty()){ + this.newAxiomSet.addAll(newAxioms); + } + + } + + /** + * Method to merge two collection of axioms to the deletions Set + * @param deleteAxioms + */ + public void addDeleteChangeAxioms(Set deleteAxioms){ + if(this.deletedAxiomSet==null){ + this.deletedAxiomSet = new HashSet(); + } + if(deleteAxioms !=null && !deleteAxioms.isEmpty()){ + this.deletedAxiomSet.addAll(deleteAxioms); + } + } + + //get method to return the deleted class axioms as Axioms + public Set getDeletedAxioms(){ + return deletedAxiomSet; + } + + + public String getIRIAsString(){ + return this.classIRI.toString(); + } + + + + public boolean isEmpty(){ + return!((this.newAxiomSet!=null && !this.newAxiomSet.isEmpty())|| + (this.deletedAxiomSet!=null && !this.deletedAxiomSet.isEmpty())); + } + + + +} diff --git a/src/main/java/diff/OntologyDifferencesRenderer.java b/src/main/java/diff/OntologyDifferencesRenderer.java new file mode 100644 index 0000000..c01f955 --- /dev/null +++ b/src/main/java/diff/OntologyDifferencesRenderer.java @@ -0,0 +1,285 @@ +package diff; + +import com.sun.corba.se.impl.orbutil.closure.Constant; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; +import java.util.Set; +import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; +import org.semanticweb.owlapi.model.OWLAxiom; +import org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom; +import org.semanticweb.owlapi.model.OWLDataPropertyRangeAxiom; +import org.semanticweb.owlapi.model.OWLObjectPropertyDomainAxiom; +import org.semanticweb.owlapi.model.OWLObjectPropertyRangeAxiom; +import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; +import org.semanticweb.owlapi.model.OWLSubDataPropertyOfAxiom; +import org.semanticweb.owlapi.model.OWLSubPropertyAxiom; +import uk.ac.manchester.cs.owl.owlapi.OWLObjectPropertyImpl; +import widoco.Constants; + +/** + * class to render diff objects in HTML. Separated from the main class + * to calculate + * @author dgarijo + */ +public class OntologyDifferencesRenderer { + + /** + * convenience method to print information on diff to console + * + * @param c + */ + public static void differenceSummaryToString(CompareOntologies c) { + System.out.println(); + System.out.println("@Ontology Change Summary"); + System.out.println("@First ontology IRI: " + c.getOldVersion()); + System.out.println("@Second ontology IRI: " + c.getNewVersion()); + System.out.println("@Number of classes changed: " + c.getModifiedClasses().size()); + System.out.println("@Number of classes added: " + c.getNewClasses().size()); + System.out.println("@Number of classes deleted: " + c.getDeletedClasses().size()); + + System.out.println("@Number of properties changed: " + c.getModifiedProperties().size()); + System.out.println("@Number of properties added: " + c.getNewProperties().size()); + System.out.println("@Number of properties deleted: " + c.getDeletedProperties().size()); + + System.out.println("@Number of data properties changed: " + c.getModifiedDataProperties().size()); + System.out.println("@Number of data properties added: " + c.getNewDataProperties().size()); + System.out.println("@Number of data properties deleted: " + c.getDeletedDataProperties().size()); + + ArrayList modifiedClasses = c.getModifiedClasses(); + if (!modifiedClasses.isEmpty()) { + System.out.println("\n@Modified classes"); + System.out.println(setToString(modifiedClasses, "Class changed", true)); + System.out.println(); + } + ArrayList newClasses = c.getNewClasses(); + if (!newClasses.isEmpty()) { + System.out.println("@New Classes"); + System.out.println(setToString(newClasses, "Class added", true)); + System.out.println(); + } + ArrayList deletedClasses = c.getDeletedClasses(); + if (!deletedClasses.isEmpty()) { + System.out.println("@Deleted Classes"); + System.out.println(setToString(deletedClasses, "Deleted class", false)); + System.out.println(); + } + ArrayList modifiedProperties = c.getModifiedProperties(); + if (!modifiedProperties.isEmpty()) { + System.out.println("\n@Modified properties"); + System.out.println(setToString(modifiedProperties, "Property changed", true)); + System.out.println(); + } + ArrayList newProperties = c.getNewProperties(); + if (!newProperties.isEmpty()) { + System.out.println("@New Properties"); + System.out.println(setToString(newProperties, "Property added", true)); + System.out.println(); + } + ArrayList deletedProperties = c.getDeletedProperties(); + if (!deletedProperties.isEmpty()) { + System.out.println("@Deleted Properties"); + System.out.println(setToString(deletedProperties, "Property deleted", false)); + System.out.println(); + } + ArrayList modifiedDataProperties = c.getModifiedDataProperties(); + if (!modifiedDataProperties.isEmpty()) { + System.out.println("\n@Modified Data properties"); + System.out.println(setToString(modifiedDataProperties, "Data property changed", true)); + System.out.println(); + } + ArrayList newDataProperties = c.getNewDataProperties(); + if (!newDataProperties.isEmpty()) { + System.out.println("@New Data Properties"); + System.out.println(setToString(newDataProperties, "Data property added", true)); + System.out.println(); + } + ArrayList deletedDataProperties = c.getDeletedDataProperties(); + if (!deletedDataProperties.isEmpty()) { + System.out.println("@Deleted Data Properties"); + System.out.println(setToString(deletedDataProperties, "Data property deleted", false)); + System.out.println(); + } + } + /** + * Method to serialize a set as a string + * @param set + * @param initialMessage + * @param printDetails true if the goal is to print more details about the changes, e.g., modification of a term + * @return + */ + private static String setToString(ArrayListset, String initialMessage, boolean printDetails){ + String v = ""; + Iterator i = set.iterator(); + while (i.hasNext()) { + OWLAxiomInfo classAxiomSet = i.next(); + //if the output is write URIs print them + v+="---\n"+initialMessage+" "; + v+=classAxiomSet.getIRIAsString()+"\n"; + + if(printDetails){ + if(classAxiomSet.getNewAxioms()!=null){ + for(OWLAxiom f:classAxiomSet.getNewAxioms()){ + v+="+"+f.toString()+"\n"; + } + } + if(classAxiomSet.getDeletedAxioms()!=null){ + for(OWLAxiom f:classAxiomSet.getDeletedAxioms()){ + v+="-"+f.toString()+"\n"; + } + } + } + } + return v; + } + + /** + * Method to serialize a set as html. This method is designed to be called by added classes and properties. + * @param set + * @param initialMessage + * @param printDetails true if the goal is to print more details about the changes, e.g., modification of a term + * @return + */ + private static String axiomInfoSetToHTML(ArrayListset, String ns, boolean showAdditions, boolean showDeletions, Properties lang){ + String v = ""; + Iterator i = set.iterator(); + while (i.hasNext()) { + OWLAxiomInfo classAxiomSet = i.next(); + //we print the whole url of the new property and link to the document reference. + v+="
  • "+classAxiomSet.getIRIAsString()+"\n"; + if(showAdditions && + classAxiomSet.getNewAxioms()!=null && !classAxiomSet.getNewAxioms().isEmpty()){ + v+="
      \n"; + v+=axiomSetToHTML(classAxiomSet.getNewAxioms(), true, lang); + v+="
    \n"; + } + if(showDeletions && + classAxiomSet.getDeletedAxioms()!=null && !classAxiomSet.getDeletedAxioms().isEmpty()){ + v+="
      \n"; + v+=axiomSetToHTML(classAxiomSet.getDeletedAxioms(), false, lang); + v+="
    \n"; + } + v+="
  • \n"; + } + return v; + } + + private static String axiomSetToHTML(Set set, boolean isAddition, Properties lang){ + String v = ""; + String message; + if(isAddition){ + message=lang.getProperty(Constants.LANG_ADDED)+": "; + }else{ + message=lang.getProperty(Constants.LANG_DELETED)+": "; + } + for(OWLAxiom f:set){ + v+="
  • "; + if(f instanceof OWLSubClassOfAxiom){ + v+=message+lang.getProperty(Constants.LANG_SUBCLASS_OF) +" "+ ((OWLSubClassOfAxiom)f).getSuperClass().asOWLClass().getIRI(); + }else if(f instanceof OWLSubPropertyAxiom){ + v+=message+lang.getProperty(Constants.LANG_SUBPROP_OF) +" "+ ((OWLObjectPropertyImpl)((OWLSubPropertyAxiom)f).getSuperProperty()).getIRI(); + }else if(f instanceof OWLObjectPropertyDomainAxiom){ + v+=message+Constants.LANG_DOMAIN+" "+((OWLObjectPropertyDomainAxiom)f).getDomain().asOWLClass().getIRI(); + }else if(f instanceof OWLDataPropertyDomainAxiom){ + v+=message+Constants.LANG_DOMAIN+" "+((OWLDataPropertyDomainAxiom)f).getDomain().asOWLClass().getIRI(); + }else if(f instanceof OWLObjectPropertyRangeAxiom){ + v+=message+Constants.LANG_RANGE+" "+((OWLObjectPropertyRangeAxiom)f).getRange().asOWLClass().getIRI(); + }else if(f instanceof OWLDataPropertyRangeAxiom){ + v+=message+Constants.LANG_RANGE+" "+((OWLDataPropertyRangeAxiom)f).getRange().asOWLDatatype().getIRI(); + }else if(f instanceof OWLAnnotationAssertionAxiom){ + v+= message+((OWLAnnotationAssertionAxiom)f).getProperty().toString() +" "+ ((OWLAnnotationAssertionAxiom)f).getValue().toString(); + }else{ + //other less typical axioms + v+=message+f.getAxiomType().getName()+" "+f.toString().replace("<", "<").replace(">", ">"); + } + /** + * To add if we want to refine + * OWLDisjointClassesAxiom, OWLDisjointDataPropertiesAxiom, OWLDisjointObjectPropertiesAxiom, + * OWLEquivalentClassesAxiom, OWLEquivalentDataPropertiesAxiom, OWLEquivalentObjectPropertiesAxiom, + * OWLFunctionalDataPropertyAxiom, OWLFunctionalObjectPropertyAxiom, + */ + v+="
  • \n"; + } + return v; + } + + /** + * Method that renders the current differences as HTML. + * @param c the comparison object with all the differences to render + * @param ontologyNamepsace namespace of the ontology to link back + * @param language language file with the labels to be used in the report + * @return + */ + public static String differencesToHTML(CompareOntologies c, String ontologyNamepsace, Properties language){ + String changelog=""; + int changesInClasses = c.getDeletedClasses().size()+c.getModifiedClasses().size()+c.getNewClasses().size(), + changesInProps = c.getDeletedProperties().size()+c.getModifiedProperties().size()+c.getNewProperties().size(), + changesInDataProps = c.getDeletedDataProperties().size()+c.getModifiedProperties().size()+c.getNewDataProperties().size(); + if(changesInClasses>0){ + changelog+="

    "+language.getProperty(Constants.LANG_CLASSES)+"

    \n";//this will be on the lang file later + if(!c.getModifiedClasses().isEmpty()){ + changelog+="

    "+language.getProperty(Constants.LANG_MODIFIED_CLASS)+"

    \n"; + changelog+="
      "; + changelog += axiomInfoSetToHTML(c.getModifiedClasses(), ontologyNamepsace, true, true, language); + changelog+="
    "; + } + if(!c.getNewClasses().isEmpty()){ + changelog+="

    "+language.getProperty(Constants.LANG_ADDED_CLASS)+"

    \n"; + changelog+="
      "; + changelog += axiomInfoSetToHTML(c.getNewClasses(), ontologyNamepsace, true, false, language); + changelog+="
    "; + } + if(!c.getDeletedClasses().isEmpty()){ + changelog+="

    "+language.getProperty(Constants.LANG_DELETED_CLASS)+"

    \n"; + changelog+="
      "; + changelog += axiomInfoSetToHTML(c.getDeletedClasses(), ontologyNamepsace, false, false, language); + changelog+="
    "; + } + + } + if(changesInProps>0){ + changelog+="

    "+language.getProperty(Constants.LANG_OBJ_PROP)+"

    \n"; + if(!c.getModifiedProperties().isEmpty()){ + changelog+="

    "+language.getProperty(Constants.LANG_MODIFIED_PROP)+"

    \n"; + changelog+="
      "; + changelog += axiomInfoSetToHTML(c.getModifiedProperties(), ontologyNamepsace, true, true, language); + changelog+="
    "; + } + if(!c.getNewProperties().isEmpty()){ + changelog+="

    "+language.getProperty(Constants.LANG_ADDED_PROP)+"

    \n"; + changelog+="
      "; + changelog += axiomInfoSetToHTML(c.getNewProperties(), ontologyNamepsace, true, false, language); + changelog+="
    "; + } + if(!c.getDeletedProperties().isEmpty()){ + changelog+="

    "+language.getProperty(Constants.LANG_DELETED_PROP)+"

    \n"; + changelog+="
      "; + changelog += axiomInfoSetToHTML(c.getDeletedProperties(), ontologyNamepsace, false, false, language); + changelog+="
    "; + } + } + if(changesInDataProps>0){ + changelog+="

    "+language.getProperty(Constants.LANG_DATA_PROP)+"

    \n"; + if(!c.getModifiedDataProperties().isEmpty()){ + changelog+="

    "+language.getProperty(Constants.LANG_MODIFIED_DATA_PROP)+"

    \n"; + changelog+="
      "; + changelog += axiomInfoSetToHTML(c.getModifiedDataProperties(), ontologyNamepsace, true, true, language); + changelog+="
    "; + } + if(!c.getNewDataProperties().isEmpty()){ + changelog+="

    "+language.getProperty(Constants.LANG_ADDED_DATA_PROP)+"

    \n"; + changelog+="
      "; + changelog += axiomInfoSetToHTML(c.getNewDataProperties(), ontologyNamepsace, true, false, language); + changelog+="
    "; + } + if(!c.getDeletedDataProperties().isEmpty()){ + changelog+="

    "+language.getProperty(Constants.LANG_DELETED_DATA_PROP)+"

    \n"; + changelog+="
      "; + changelog += axiomInfoSetToHTML(c.getDeletedDataProperties(), ontologyNamepsace, false, false, language); + changelog+="
    "; + } + } + return changelog; + } +} diff --git a/src/main/java/licensius/GetLicense.java b/src/main/java/licensius/GetLicense.java index 5e1954f..c17b926 100644 --- a/src/main/java/licensius/GetLicense.java +++ b/src/main/java/licensius/GetLicense.java @@ -38,14 +38,14 @@ public static String getTitle(String uriToScan) { String output="unknown"; try { - String uri=Constants.licensiusURIServiceLicenseInfo; + String uri=Constants.LICENSIUS_URI_SEVICE_LICENSE_INFO; String encodedData = URLEncoder.encode(uriToScan); uri+=encodedData; System.out.println(uri); URL url = new URL(uri); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); - conn.setConnectTimeout(Constants.licensiusTimeOut); + conn.setConnectTimeout(Constants.LICENSIUS_TIME_OUT); conn.setRequestMethod("GET"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-Length", String.valueOf(encodedData.length())); @@ -75,7 +75,7 @@ public static String getTitle(String uriToScan) { public static String getFirstLicenseFound(String uriToScan) { String output="unknown"; try { - String uri=Constants.licensiusURIServiceLicense; + String uri=Constants.LICENSUS_URI_SERVICE_LICENSE; String encodedData = URLEncoder.encode(uriToScan); uri+=encodedData; System.out.println(uri); @@ -85,7 +85,7 @@ public static String getFirstLicenseFound(String uriToScan) { conn.setRequestMethod("GET"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-Length", String.valueOf(encodedData.length())); - conn.setConnectTimeout(Constants.licensiusTimeOut); + conn.setConnectTimeout(Constants.LICENSIUS_TIME_OUT); if (conn.getResponseCode() != 200) { throw new RuntimeException("HTTP error code : "+ conn.getResponseCode()); } diff --git a/src/main/java/lode/LODEGeneration.java b/src/main/java/lode/LODEGeneration.java index 02cdbb5..3e66461 100644 --- a/src/main/java/lode/LODEGeneration.java +++ b/src/main/java/lode/LODEGeneration.java @@ -78,7 +78,6 @@ private static String parseWithOWLAPI( String result = ""; OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntology ontology; -// ontology = manager.loadOntology(IRI.create("https://raw.githubusercontent.com/wf4ever/ro/master/ro.owl")); ontology= manager.loadOntologyFromOntologyDocument(new File(ontologyURL)); // // else{ diff --git a/src/main/java/oops/OOPSevaluation.java b/src/main/java/oops/OOPSevaluation.java index c45d80c..c0532fc 100644 --- a/src/main/java/oops/OOPSevaluation.java +++ b/src/main/java/oops/OOPSevaluation.java @@ -70,7 +70,7 @@ public OOPSevaluation(String uriOnto, String content) throws IOException { String uri = "http://oops-ws.oeg-upm.net/rest"; URL url = new URL(uri); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setConnectTimeout(Constants.oopsTimeOut); + connection.setConnectTimeout(Constants.OOPS_TIME_OUT); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty("Connection", "Keep-Alive"); diff --git a/src/main/java/widoco/Configuration.java b/src/main/java/widoco/Configuration.java index de0bd55..fc9fcf0 100644 --- a/src/main/java/widoco/Configuration.java +++ b/src/main/java/widoco/Configuration.java @@ -73,6 +73,7 @@ public class Configuration { private boolean includeAnnotationProperties; private boolean includeNamedIndividuals; private boolean includeIndex; + private boolean includeChangeLog; private String abstractPath; private String introductionPath; private String overviewPath; @@ -153,6 +154,7 @@ public void initializeConfig(){ includeAnnotationProperties = false; includeNamedIndividuals = true; includeIndex = true; + includeChangeLog = true; if(languages==null){ currentLanguage = "en"; languages = new HashMap(); @@ -203,31 +205,31 @@ private void loadPropertyFile(String path){ //this forces the property file to be in UTF 8 instead of the ISO propertyFile.load(new InputStreamReader(new FileInputStream(path), "UTF-8")); //We try to load from the configuration file. If it fails, then we should try to load from the ontology. Then, if it fails, we should ask the user. - abstractSection = propertyFile.getProperty(Constants.abstractSectionContent); - mainOntologyMetadata.setTitle (propertyFile.getProperty(Constants.ontTitle,"Title goes here")); - mainOntologyMetadata.setReleaseDate(propertyFile.getProperty(Constants.dateOfRelease, "Date of release")); - mainOntologyMetadata.setPreviousVersion(propertyFile.getProperty(Constants.previousVersionURI)); - mainOntologyMetadata.setThisVersion(propertyFile.getProperty(Constants.thisVersionURI)); - mainOntologyMetadata.setLatestVersion(propertyFile.getProperty(Constants.latestVersionURI)); - mainOntologyMetadata.setName(propertyFile.getProperty(Constants.ontName)); - mainOntologyMetadata.setNamespacePrefix(propertyFile.getProperty(Constants.ontPrefix)); - mainOntologyMetadata.setNamespaceURI(propertyFile.getProperty(Constants.ontNamespaceURI)); - mainOntologyMetadata.setRevision(propertyFile.getProperty(Constants.ontologyRevision)); + abstractSection = propertyFile.getProperty(Constants.ABSTRACT_SECTION_CONTENT); + mainOntologyMetadata.setTitle (propertyFile.getProperty(Constants.ONT_TITLE,"Title goes here")); + mainOntologyMetadata.setReleaseDate(propertyFile.getProperty(Constants.DATE_OF_RELEASE, "Date of release")); + mainOntologyMetadata.setPreviousVersion(propertyFile.getProperty(Constants.PREVIOUS_VERSION)); + mainOntologyMetadata.setThisVersion(propertyFile.getProperty(Constants.THIS_VERSION_URI)); + mainOntologyMetadata.setLatestVersion(propertyFile.getProperty(Constants.LATEST_VERSION_URI)); + mainOntologyMetadata.setName(propertyFile.getProperty(Constants.ONT_NAME)); + mainOntologyMetadata.setNamespacePrefix(propertyFile.getProperty(Constants.ONT_PREFIX)); + mainOntologyMetadata.setNamespaceURI(propertyFile.getProperty(Constants.ONT_NAMESPACE_URI)); + mainOntologyMetadata.setRevision(propertyFile.getProperty(Constants.ONTOLOGY_REVISION)); Agent publisher = new Agent(); - publisher.setName(propertyFile.getProperty(Constants.publisher,"")); - publisher.setURL(propertyFile.getProperty(Constants.publisherURI,"")); - publisher.setInstitutionName(propertyFile.getProperty(Constants.publisherInstitution, "")); - publisher.setInstitutionURL(propertyFile.getProperty(Constants.publisherInstitutionURI, "")); + publisher.setName(propertyFile.getProperty(Constants.PUBLISHER,"")); + publisher.setURL(propertyFile.getProperty(Constants.PUBLISHER_URI,"")); + publisher.setInstitutionName(propertyFile.getProperty(Constants.PUBLISHER_INSTITUTION, "")); + publisher.setInstitutionURL(propertyFile.getProperty(Constants.PUBLISHER_INSTITUTION_URI, "")); mainOntologyMetadata.setPublisher(publisher); - String aux = propertyFile.getProperty(Constants.authors,""); + String aux = propertyFile.getProperty(Constants.AUTHORS,""); String[] names,urls,authorInst, authorInstURI; if(!aux.equals("")){ names = aux.split(";"); - aux = propertyFile.getProperty(Constants.authorsURI,""); + aux = propertyFile.getProperty(Constants.AUTHORS_URI,""); urls = aux.split(";"); - aux = propertyFile.getProperty(Constants.authorsInstitution,""); + aux = propertyFile.getProperty(Constants.AUTHORS_INSTITUTION,""); authorInst = aux.split(";"); - aux = propertyFile.getProperty(Constants.authorsInstitutionURI,""); + aux = propertyFile.getProperty(Constants.AUTHORS_INSTITUTION_URI,""); authorInstURI = aux.split(";"); for(int i =0; i< names.length; i++){ Agent a = new Agent(); @@ -250,14 +252,14 @@ private void loadPropertyFile(String path){ mainOntologyMetadata.getCreators().add(a); } } - aux = propertyFile.getProperty(Constants.contributors,""); + aux = propertyFile.getProperty(Constants.CONTRIBUTORS,""); if(!aux.equals("")){ names = aux.split(";"); - aux = propertyFile.getProperty(Constants.contributorsURI,""); + aux = propertyFile.getProperty(Constants.CONTRIBUTORS_URI,""); urls = aux.split(";"); - aux = propertyFile.getProperty(Constants.contributorsInstitution,""); + aux = propertyFile.getProperty(Constants.CONTRIBUTORS_INSTITUTION,""); authorInst = aux.split(";"); - aux = propertyFile.getProperty(Constants.contributorsInstitutionURI,""); + aux = propertyFile.getProperty(Constants.CONTRIBUTORS_INSTITUTION_URI,""); authorInstURI = aux.split(";"); for(int i =0; i< names.length; i++){ Agent a = new Agent(); @@ -280,9 +282,9 @@ private void loadPropertyFile(String path){ mainOntologyMetadata.getContributors().add(a); } } - aux = propertyFile.getProperty(Constants.importedOntologyNames,""); + aux = propertyFile.getProperty(Constants.IMPORTED_ONTOLOGY_NAMES,""); names = aux.split(";"); - aux = propertyFile.getProperty(Constants.importedOntologyURIs,""); + aux = propertyFile.getProperty(Constants.IMPORTED_ONTOLOGY_URIS,""); urls = aux.split(";"); for(int i =0; i< names.length; i++){ if(!"".equals(names[i])){ @@ -296,9 +298,9 @@ private void loadPropertyFile(String path){ mainOntologyMetadata.getImportedOntologies().add(o); } } - aux = propertyFile.getProperty(Constants.extendedOntologyNames,""); + aux = propertyFile.getProperty(Constants.EXTENDED_ONTOLOGY_NAMES,""); names = aux.split(";"); - aux = propertyFile.getProperty(Constants.extendedOntologyURIs,""); + aux = propertyFile.getProperty(Constants.EXTENDED_ONTOLOGY_URIS,""); urls = aux.split(";"); for(int i =0; i< names.length; i++){ if(!"".equals(names[i])){ @@ -312,11 +314,11 @@ private void loadPropertyFile(String path){ mainOntologyMetadata.getExtendedOntologies().add(o); } } - mainOntologyMetadata.getLicense().setName(propertyFile.getProperty(Constants.licenseName,"")); - mainOntologyMetadata.getLicense().setUrl(propertyFile.getProperty(Constants.licenseURI,"")); - mainOntologyMetadata.getLicense().setIcon(propertyFile.getProperty(Constants.licenseIconURL,"")); + mainOntologyMetadata.getLicense().setName(propertyFile.getProperty(Constants.LICENSE_NAME,"")); + mainOntologyMetadata.getLicense().setUrl(propertyFile.getProperty(Constants.LICENSE_URI,"")); + mainOntologyMetadata.getLicense().setIcon(propertyFile.getProperty(Constants.LICENSE_ICON_URL,"")); mainOntologyMetadata.setStatus(propertyFile.getProperty(Constants.STATUS,"Specification Draft")); - mainOntologyMetadata.setCiteAs(propertyFile.getProperty(Constants.citeAs, "")); + mainOntologyMetadata.setCiteAs(propertyFile.getProperty(Constants.CITE_AS, "")); mainOntologyMetadata.setDoi(propertyFile.getProperty(Constants.DOI, "")); //vocabLoadedSerialization = propertyFile.getProperty(TextConstants.deafultSerialization, "RDF/XML"); String serializationRDFXML = propertyFile.getProperty(Constants.RDF,""); @@ -376,7 +378,7 @@ public void loadPropertiesFromOntology(OntModel m){ if(propertyName.equals("title")){ mainOntologyMetadata.setTitle(value); }else - if(propertyName.equals("replaces")||propertyName.equals("wasRevisionOf")){ + if(propertyName.equals("replaces")||propertyName.equals("wasRevisionOf")||propertyName.equals("priorVersion")){ mainOntologyMetadata.setPreviousVersion(value); }else if(propertyName.equals("versionInfo")){ @@ -588,6 +590,12 @@ public boolean isIncludeCrossReferenceSection() { public boolean isIncludeIndex() { return includeIndex; } + + public boolean isIncludeChangeLog() { + return includeChangeLog; + } + + @@ -630,6 +638,11 @@ public void setIncludeCrossReferenceSection(boolean includeCrossReferenceSection public void setIncludeIndex(boolean includeIndex) { this.includeIndex = includeIndex; } + + public void setIncludeChangeLog(boolean includeChangeLog) { + this.includeChangeLog = includeChangeLog; + } + diff --git a/src/main/java/widoco/Constants.java b/src/main/java/widoco/Constants.java index 41bd8d8..a21b516 100644 --- a/src/main/java/widoco/Constants.java +++ b/src/main/java/widoco/Constants.java @@ -15,6 +15,8 @@ */ package widoco; +import diff.CompareOntologies; +import diff.OntologyDifferencesRenderer; import java.io.File; import java.util.ArrayList; import java.util.Date; @@ -31,58 +33,127 @@ */ public class Constants { //constants for the Licensius service - public static final String licensiusURIServiceLicense = "http://www.licensius.com/api/license/findlicenseinrdf?uri=";//"http://licensius.appspot.com/getLicense?content="; - public static final String licensiusURIServiceLicenseInfo = "http://www.licensius.com/api/license/getlicenseinfo?uri=";//"http://licensius.appspot.com/getLicenseTitle?content="; - public static final int licensiusTimeOut = 10000; + public static final String LICENSUS_URI_SERVICE_LICENSE = "http://www.licensius.com/api/license/findlicenseinrdf?uri=";//"http://licensius.appspot.com/getLicense?content="; + public static final String LICENSIUS_URI_SEVICE_LICENSE_INFO = "http://www.licensius.com/api/license/getlicenseinfo?uri=";//"http://licensius.appspot.com/getLicenseTitle?content="; + public static final int LICENSIUS_TIME_OUT = 10000; - public static final int oopsTimeOut = 30000; + public static final int OOPS_TIME_OUT = 30000; public static final String WEBVOWL_SERVICE = "http://vowl.visualdataweb.org/webvowl/index.html#iri="; - public static final String[] vocabPossibleSerializations = {"application/rdf+xml","text/turtle","text/n3"}; + public static final String[] POSSIBLE_VOCAB_SERIALIZATIONS = {"application/rdf+xml","text/turtle","text/n3"}; + /** - * Constants for the Step 2 (table) + * Constants for the property file with the ontology metadata */ - public static final String abstractSectionContent="abstract"; - public static final String ontTitle="ontologyTitle"; - public static final String ontName="ontologyName"; - public static final String ontPrefix="ontologyPrefix"; - public static final String ontNamespaceURI="ontologyNamespaceURI"; - public static final String dateOfRelease="dateOfRelease"; - public static final String thisVersionURI="thisVersionURI"; - public static final String latestVersionURI="latestVersionURI"; - public static final String previousVersionURI="previousVersionURI"; - public static final String ontologyRevision="ontologyRevisionNumber"; - public static final String authors="authors"; - public static final String authorsURI="authorsURI"; - public static final String authorsInstitution="authorsInstitution"; - public static final String authorsInstitutionURI="authorsInstitutionURI"; - public static final String contributors="contributors"; - public static final String contributorsURI="contributorsURI"; - public static final String contributorsInstitution="contributorsInstitution"; - public static final String contributorsInstitutionURI="contributorsInstitutionURI"; - public static final String publisher="publisher"; - public static final String publisherURI="publisherURI"; - public static final String publisherInstitution="publisherInstitution"; - public static final String publisherInstitutionURI="publisherInstitutionURI"; - public static final String importedOntologyNames="importedOntologyNames"; - public static final String importedOntologyURIs="importedOntologyURIs"; - public static final String extendedOntologyNames="extendedOntologyNames"; - public static final String extendedOntologyURIs="extendedOntologyURIs"; - public static final String licenseName="licenseName"; - public static final String licenseURI="licenseURI"; - public static final String licenseIconURL="licenseIconURL"; - public static final String citeAs="citeAs"; + public static final String ABSTRACT_SECTION_CONTENT="abstract"; + public static final String ONT_TITLE="ontologyTitle"; + public static final String ONT_NAME="ontologyName"; + public static final String ONT_PREFIX="ontologyPrefix"; + public static final String ONT_NAMESPACE_URI="ontologyNamespaceURI"; + public static final String DATE_OF_RELEASE="dateOfRelease"; + public static final String THIS_VERSION_URI="thisVersionURI"; + public static final String LATEST_VERSION_URI="latestVersionURI"; + public static final String PREVIOUS_VERSION="previousVersionURI"; + public static final String ONTOLOGY_REVISION="ontologyRevisionNumber"; + public static final String AUTHORS="authors"; + public static final String AUTHORS_URI="authorsURI"; + public static final String AUTHORS_INSTITUTION="authorsInstitution"; + public static final String AUTHORS_INSTITUTION_URI="authorsInstitutionURI"; + public static final String CONTRIBUTORS="contributors"; + public static final String CONTRIBUTORS_URI="contributorsURI"; + public static final String CONTRIBUTORS_INSTITUTION="contributorsInstitution"; + public static final String CONTRIBUTORS_INSTITUTION_URI="contributorsInstitutionURI"; + public static final String PUBLISHER="publisher"; + public static final String PUBLISHER_URI="publisherURI"; + public static final String PUBLISHER_INSTITUTION="publisherInstitution"; + public static final String PUBLISHER_INSTITUTION_URI="publisherInstitutionURI"; + public static final String IMPORTED_ONTOLOGY_NAMES="importedOntologyNames"; + public static final String IMPORTED_ONTOLOGY_URIS="importedOntologyURIs"; + public static final String EXTENDED_ONTOLOGY_NAMES="extendedOntologyNames"; + public static final String EXTENDED_ONTOLOGY_URIS="extendedOntologyURIs"; + public static final String LICENSE_NAME="licenseName"; + public static final String LICENSE_URI="licenseURI"; + public static final String LICENSE_ICON_URL="licenseIconURL"; + public static final String CITE_AS="citeAs"; public static final String DOI="DOI"; public static final String RDF="RDFXMLSerialization"; public static final String TTL="TurtleSerialization"; public static final String N3="N3Serialization"; public static final String JSON="JSONLDSerialization"; -// public static final String deafultSerialization="deafultSerialization"; - /**Property that will retrieve the status of the document from the property file**/ + + /*Property that will retrieve the status of the document from the property file*/ public static final String STATUS="status"; + + //Constants for language tags. These are the names used in the property file + //This way, if refactoring is needed we only have to change it here. + public static final String LANG_ABSTRACT = "abstract"; + public static final String LANG_ABSTRACT_PLACEHOLDER = "abstractPlaceHolder"; + public static final String LANG_INTRO_PLACEHODER = "introPlaceHolder"; + public static final String LANG_REFERENCES_PLACEHOLDER = "referencesPlaceHolder"; + public static final String LANG_AUTHORS = AUTHORS; + public static final String LANG_CONTRIBUTORS = CONTRIBUTORS; + public static final String LANG_AC_TEXT = "ackText"; + public static final String LANG_PUBLISHER = PUBLISHER; + public static final String LANG_IMPORTED = "imported"; + public static final String LANG_EXTENDED = "extended"; + public static final String LANG_NS = "ns"; + public static final String LANG_NS_TEXT = "nsText"; + public static final String LANG_BACK3 = "back3"; + public static final String LANG_DATE = "date"; + public static final String LANG_THIS_VERSION = "thisVersion"; + public static final String LANG_LATEST_VERSION = "latestVersion"; + public static final String LANG_PREVIOUS_VERSION = "previousVersion"; + public static final String LANG_REVISION = "revision"; + public static final String LANG_SERIALIZATION = "serialization"; + public static final String LANG_LICENSE_URL_IF_NULL = "licenseURLIfNull"; + public static final String LANG_LICENSE = "license"; + public static final String LANG_LICENSE_IF_NULL = "licenseIfNull"; + public static final String LANG_VISUALIZATION = "visualization"; + public static final String LANG_CITE_AS = "citeAs"; + public static final String LANG_PRPOV_HEAD = "provHead"; + public static final String LANG_OVERVIEW_PLACEHOLDER = "overviewPlaceHolder"; + public static final String LANG_DESCRIPTION_PLACEHOLDER = "descriptionPlaceHolder"; + public static final String LANG_CROSS_REF_TITLE = "crossRefTitle"; + public static final String LANG_CROSS_REF_TITLE2 = "crossRefTitle2"; + public static final String LANG_CROSS_REF_PLACEHOLDER = "crossRefPlaceHolder"; + public static final String LANG_PROV1 = "prov1"; + public static final String LANG_PROV2 = "prov2"; + public static final String LANG_CREATED_BY = "createdBy"; + public static final String LANG_CONTRIBUTED_BY = "contribBy"; + public static final String LANG_SPEC = "spec"; + public static final String LANG_REV = "rev"; + public static final String LANG_RESULT = "result"; + public static final String LANG_GENERATED = "generated"; + public static final String LANG_BACK = "back"; + public static final String LANG_BACK1 = "back1"; + public static final String LANG_BACK2 = "back2"; + public static final String LANG_NOT_ACC_PAGE = "notAccPage"; + 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_ANN_PROP = "annProp"; + public static final String LANG_NAMED_INDIV = "namedIndiv"; + //labels for the changelog + public static final String LANG_CHANGELOG_HEAD = "changelogHead"; + public static final String LANG_ADDED_CLASS = "addedClass"; + public static final String LANG_MODIFIED_CLASS = "modifiedClass"; + public static final String LANG_DELETED_CLASS = "deletedClass"; + public static final String LANG_ADDED_PROP = "addedProp"; + public static final String LANG_MODIFIED_PROP = "modifiedProp"; + public static final String LANG_DELETED_PROP = "deletedProp"; + public static final String LANG_MODIFIED_DATA_PROP = "modifiedDataProp"; + public static final String LANG_ADDED_DATA_PROP = "addedDataProp"; + public static final String LANG_DELETED_DATA_PROP = "deletedDataProp"; + public static final String LANG_ADDED = "added"; + public static final String LANG_DELETED = "deleted"; + public static final String LANG_SUBCLASS_OF = "subClassOf"; + public static final String LANG_SUBPROP_OF = "subPropOf"; + public static final String LANG_DOMAIN = "domain"; + public static final String LANG_RANGE = "range"; + /** * Head section of the HTML document. */ @@ -91,13 +162,14 @@ public class Constants { + "\n"; //missing specialization. Missing alternate + public static String getAbstractSection(String abstractContent, Configuration c, Properties langFile){ - String abstractSection = "

    "+langFile.getProperty("abstract")+"

    "; + String abstractSection = "

    "+langFile.getProperty(LANG_ABSTRACT)+"

    "; if(abstractContent!=null && !"".equals(abstractContent)){ abstractSection+=abstractContent; } else{ - abstractSection+=langFile.getProperty("abstractPlaceHolder"); + abstractSection+=langFile.getProperty(LANG_ABSTRACT_PLACEHOLDER); } return abstractSection; } @@ -118,23 +190,28 @@ public static String getStatus(Configuration c){ } public static String getIntroductionSection(Configuration c, Properties lang){ - String s = "

    "+lang.getProperty("introPlaceHolder"); + String s = "

    "+lang.getProperty(LANG_INTRO_PLACEHODER); return s; } public static String getReferencesSection(Configuration c, Properties lang){ - String s ="

    "+lang.getProperty("referencesPlaceHolder"); + String s ="

    "+lang.getProperty(LANG_REFERENCES_PLACEHOLDER); return s; } public static String getAcknowledgementsSection(Configuration c, Properties lang){ String s = "
    \n"+ - "

    "+lang.getProperty("ackText"); + "

    "+lang.getProperty(LANG_AC_TEXT); return s; } - public static String getChangeLogSection(Properties lang){ - return lang.getProperty("changeLog"); + public static String getChangeLogSection(Configuration c, CompareOntologies comp, Properties lang){ + String s = "
    \n"+ + "

    "+lang.getProperty(LANG_CHANGELOG_HEAD)+"

    \n"; + s+=OntologyDifferencesRenderer.differencesToHTML(comp, c.getMainOntology().getNamespaceURI(), lang); + s+="
    "; + //return lang.getProperty("changeLog"); + return s; } - public static final String ending=""; + public static final String ENDING=""; //given a list of agents, this method gets it as an html String private static String getAgents(ArrayList auth){ @@ -146,7 +223,7 @@ private static String getAgents(ArrayList auth){ Agent currAuth = it.next(); String authorName = currAuth.getName(); //the name should be always there if(authorName==null || "".equals(authorName)){ - authorName = "Agent"+i; + authorName = "Agent "+i; i++; } if(currAuth.getURL()!=null &&!"".equals(currAuth.getURL())){ @@ -173,14 +250,14 @@ private static String getAgents(ArrayList auth){ return agents; } private static String getAuthors(ArrayList auth, Properties l) { - String a="
    "+l.getProperty("authors")+"
    \n"; + String a="
    "+l.getProperty(LANG_AUTHORS)+"
    \n"; //the same amount of names and institutions is assumed. a+=getAgents(auth); return a +"
    \n"; } private static String getContributors(ArrayList contrib, Properties l) { - String c="
    "+l.getProperty("contributors")+"
    \n"; + String c="
    "+l.getProperty(LANG_CONTRIBUTORS)+"
    \n"; c+=getAgents(contrib); return c +"
    \n"; } @@ -191,7 +268,7 @@ private static String getPublisher (Agent publisher, Properties l){ if(publisher.getName()==null && "".equals(publisher.getName())){ publisher.setName(publisher.getURL()); } - String c="
    "+l.getProperty("publisher")+"
    \n"; + String c="
    "+l.getProperty(LANG_PUBLISHER)+"
    \n"; ArrayList p = new ArrayList(); p.add(publisher); c+=getAgents(p); @@ -222,13 +299,13 @@ private static String getOntologies(ArrayList ontos){ return ontologies; } private static String getImports(ArrayList ontos, Properties l) { - String imports= "
    "+l.getProperty("imported")+"
    \n"; + String imports= "
    "+l.getProperty(LANG_IMPORTED)+"
    \n"; imports+= getOntologies(ontos); return imports+"
    \n"; } private static String getExtends(ArrayList ontos, Properties l) { - String extended= "
    "+l.getProperty("extended")+"
    \n"; + String extended= "
    "+l.getProperty(LANG_EXTENDED)+"
    \n"; extended += getOntologies(ontos); extended = extended.replace("owl:imports",""); //to remove the import annotation return extended+"
    \n"; @@ -236,7 +313,7 @@ private static String getExtends(ArrayList ontos, Properties l) { public static String getNameSpaceDeclaration(HashMap namesp, Properties lang){ String ns="
    \n"+ - "

    "+lang.getProperty("ns")+lang.getProperty("nsText") ; + "

    "+lang.getProperty(LANG_NS)+lang.getProperty(LANG_NS_TEXT) ; Iterator keys = namesp.keySet().iterator(); while(keys.hasNext()){ String current = keys.next(); @@ -363,7 +440,7 @@ public static String getIndexDocument(String resourcesFolderName,Configuration c " $('html, body').animate({scrollTop: $(hash).offset().top}, 0);\n"+ "}\n" + " loadTOC();\n"+ - "}" + "}\n" + "function loadTOC(){\n" + " //process toc dynamically\n" + " var t='

    Table of contents

      ';i = 1;j=0;\n" + @@ -383,24 +460,30 @@ public static String getIndexDocument(String resourcesFolderName,Configuration c " j++;\n" + " t+= '
    • '+(i-1)+'.'+j+'. '+''+ jQuery(this).text()+'
    • ';\n" + " }\n" + - " t = t.replace(' "+lang.getProperty("back3").replace("í", "í")+"','');\n" +//back to ToC + " t = t.replace(' "+lang.getProperty(LANG_BACK3).replace("í", "í")+"','');\n" +//back to ToC " });\n" + " t+='
    ';\n" + " $(\"#toc\").html(t); \n" + - "}"+ + "}\n"+ " $(function(){\n"; + //the script for loading the table is called after loading everything else, after the loadHash function if(c.isIncludeAbstract()) document += " $(\"#abstract\").load(\"sections/abstract-"+c.getCurrentLanguage()+".html\"); \n"; if(c.isIncludeIntroduction()) document += " $(\"#introduction\").load(\"sections/introduction-"+c.getCurrentLanguage()+".html\"); \n"; if(c.isIncludeOverview()) document += " $(\"#overview\").load(\"sections/overview-"+c.getCurrentLanguage()+".html\"); \n"; if(c.isIncludeDescription()) document += " $(\"#description\").load(\"sections/description-"+c.getCurrentLanguage()+".html\"); \n"; if(c.isIncludeReferences()) document += " $(\"#references\").load(\"sections/references-"+c.getCurrentLanguage()+".html\"); \n"; + if(c.isIncludeChangeLog()){ + if(c.getMainOntology().getPreviousVersion()!=null &&!"".equals(c.getMainOntology().getPreviousVersion())){ + document += " $(\"#changelog\").load(\"sections/changelog-"+c.getCurrentLanguage()+".html\"); \n"; + } + } if(c.isIncludeCrossReferenceSection()) document += " $(\"#crossref\").load(\"sections/crossref-"+c.getCurrentLanguage()+".html\", null, loadHash); \n"; + document+=" });\n" + " \n" + " \n" + "\n" + "\n"; - ; document += getHeadSection(c, lang); document += getStatus(c); if(c.isIncludeAbstract()) document += "
    \n"; @@ -411,8 +494,12 @@ public static String getIndexDocument(String resourcesFolderName,Configuration c if(c.isIncludeDescription()) document += "
    \n"; if(c.isIncludeCrossReferenceSection()) document += "
    \n"; if(c.isIncludeReferences()) document += "
    \n"; - document+= getAcknowledgementsSection(c, lang)+" \n" + - ""; + if(c.isIncludeChangeLog() && c.getMainOntology().getPreviousVersion()!=null + &&!"".equals(c.getMainOntology().getPreviousVersion())) { + document += "
    \n"; + } + document+= getAcknowledgementsSection(c, lang)+" \n" + + ""; return document; } @@ -429,23 +516,23 @@ public static String getHeadSection(Configuration c, Properties l){ if(c.getMainOntology().getTitle()!=null &&!"".equals(c.getMainOntology().getTitle())) head+="

    "+c.getMainOntology().getTitle()+"

    \n"; if(c.getMainOntology().getReleaseDate()!=null && !"".equals(c.getMainOntology().getReleaseDate())) - head+="

    "+l.getProperty("date")+" "+c.getMainOntology().getReleaseDate()+"

    \n"; + head+="

    "+l.getProperty(LANG_DATE)+" "+c.getMainOntology().getReleaseDate()+"

    \n"; if(c.getMainOntology().getThisVersion()!=null && !"".equals(c.getMainOntology().getThisVersion())) head+="
    \n"+ - "
    "+l.getProperty("thisVersion")+"
    \n"+ + "
    "+l.getProperty(LANG_THIS_VERSION)+"
    \n"+ "
    "+c.getMainOntology().getThisVersion()+"
    \n"+ "
    "; if(c.getMainOntology().getLatestVersion()!=null && !"".equals(c.getMainOntology().getLatestVersion())) - head+="
    "+l.getProperty("latestVersion")+"
    \n"+ + head+="
    "+l.getProperty(LANG_LATEST_VERSION)+"
    \n"+ "
    "+c.getMainOntology().getLatestVersion()+"
    \n"+ "
    "; if(c.getMainOntology().getPreviousVersion()!=null && !"".equals(c.getMainOntology().getPreviousVersion())) head+= "
    \n"+ - "
    "+l.getProperty("previousVersion")+"
    \n"+ + "
    "+l.getProperty(LANG_PREVIOUS_VERSION)+"
    \n"+ "
    "+c.getMainOntology().getPreviousVersion()+"
    \n"+ "
    \n"; if(c.getMainOntology().getRevision()!=null && !"".equals(c.getMainOntology().getRevision())) - head +="
    "+l.getProperty("revision")+"
    \n"+ + head +="
    "+l.getProperty(LANG_REVISION)+"
    \n"+ "
    "+c.getMainOntology().getRevision()+"
    \n"; if(!c.getMainOntology().getCreators().isEmpty()) head += getAuthors(c.getMainOntology().getCreators(),l)+"\n"; @@ -460,7 +547,7 @@ public static String getHeadSection(Configuration c, Properties l){ head += getExtends(c.getMainOntology().getExtendedOntologies(),l)+"\n"; HashMap availableSerializations = c.getMainOntology().getSerializations(); - head+="
    "+l.getProperty("serialization")+"
    "; + head+="
    "+l.getProperty(LANG_SERIALIZATION)+"
    "; for(String serialization:availableSerializations.keySet()){ head+="\""+serialization+"\" "; } @@ -469,9 +556,9 @@ public static String getHeadSection(Configuration c, Properties l){ if(c.getMainOntology().getLicense()!=null){ String lname = c.getMainOntology().getLicense().getName();//"license name goes here"; String licenseURL = c.getMainOntology().getLicense().getUrl();//"http://insertlicenseURIhere.org"; - if(licenseURL == null || "".equals(licenseURL))licenseURL = l.getProperty("licenseURLIfNull"); - if(lname == null || "".equals(lname)) lname = l.getProperty("licenseIfNull"); - head+="
    "+l.getProperty("license")+"
    " + if(licenseURL == null || "".equals(licenseURL))licenseURL = l.getProperty(LANG_LICENSE_URL_IF_NULL); + if(lname == null || "".equals(lname)) lname = l.getProperty(LANG_LICENSE_IF_NULL); + head+="
    "+l.getProperty(LANG_LICENSE)+"
    " + "\""+licenseURL+"\"\n"; if(c.getMainOntology().getLicense().getIcon()!=null && !"".equals(c.getMainOntology().getLicense().getIcon())){ head+="\n" + @@ -482,21 +569,21 @@ public static String getHeadSection(Configuration c, Properties l){ } //add lang tags here if(c.isCreateWebVowlVisualization()){ - head+="
    "+l.getProperty("visualization")+"
    " + head+="
    "+l.getProperty(LANG_VISUALIZATION)+"
    " + "
    " + "\"Visualize" + "
    " + "
    \n"; } if(!"".equals(c.getMainOntology().getCiteAs()) && c.getMainOntology().getCiteAs()!=null){ - head+="
    "+l.getProperty("citeAs")+"
    \n
    "+c.getMainOntology().getCiteAs()+"
    \n
    \n"; + head+="
    "+l.getProperty(LANG_CITE_AS)+"
    \n
    "+c.getMainOntology().getCiteAs()+"
    \n
    \n"; } if(!"".equals(c.getMainOntology().getDoi()) && c.getMainOntology().getDoi()!=null){ //doi is common for all languages head+="
    DOI:
    \n
    \""+c.getMainOntology().getDoi()+"\"
    \n
    \n"; } if(c.isPublishProvenance()){ - head+="
    "+l.getProperty("provHead")+"
    "; + head+="
    "+l.getProperty(LANG_PRPOV_HEAD)+"
    "; } head+= "
    \n"+ "

    \n"; @@ -504,16 +591,16 @@ public static String getHeadSection(Configuration c, Properties l){ } public static String getOverviewSection(Configuration c, Properties lang){ - return "

    "+c.getMainOntology().getName()+": "+lang.getProperty("overviewPlaceHolder"); + return "

    "+c.getMainOntology().getName()+": "+lang.getProperty(LANG_OVERVIEW_PLACEHOLDER); } public static String getDescriptionSection(Configuration c, Properties lang){ - return "

    "+c.getMainOntology().getName()+": "+lang.getProperty("descriptionPlaceHolder"); + return "

    "+c.getMainOntology().getName()+": "+lang.getProperty(LANG_DESCRIPTION_PLACEHOLDER); } public static String getCrossReferenceSection(Configuration c, Properties lang){ - return "

    "+lang.getProperty("crossRefTitle")+" "+c.getMainOntology().getName()+" "+lang.getProperty("crossRefTitle2")+"

    "+"\n" + - lang.getProperty("crossRefPlaceHolder")+c.getMainOntology().getName()+".\n"; + return "

    "+lang.getProperty(LANG_CROSS_REF_TITLE)+" "+c.getMainOntology().getName()+" "+lang.getProperty(LANG_CROSS_REF_TITLE2)+"

    "+"\n" + + lang.getProperty(LANG_CROSS_REF_PLACEHOLDER)+c.getMainOntology().getName()+".\n"; } public static String getProvenanceHtml(Configuration c, Properties lang){ @@ -531,11 +618,11 @@ public static String getProvenanceHtml(Configuration c, Properties lang){ provURI = c.getDocumentationURI(); } if(c.getMainOntology().getTitle()!=null &&!"".equals(c.getMainOntology().getTitle())){ - provhtml+="

    "+lang.getProperty("prov1")+" "+c.getMainOntology().getTitle()+" "+lang.getProperty("prov2")+" ("+provURI+")

    \n"; + provhtml+="

    "+lang.getProperty(LANG_PROV1)+" "+c.getMainOntology().getTitle()+" "+lang.getProperty(LANG_PROV2)+" ("+provURI+")

    \n"; } provhtml+="
      \n"; if(!c.getMainOntology().getCreators().isEmpty()){ - provhtml+="
    • "+lang.getProperty("createdBy")+" :\n"; + provhtml+="
    • "+lang.getProperty(LANG_CREATED_BY)+" :\n"; Iterator creators = c.getMainOntology().getCreators().iterator(); while(creators.hasNext()){ Agent currCreator = creators.next(); @@ -544,7 +631,7 @@ public static String getProvenanceHtml(Configuration c, Properties lang){ provhtml+="
    • "; } if(!c.getMainOntology().getContributors().isEmpty()){ - provhtml+="
    • "+lang.getProperty("contribBy")+":\n"; + provhtml+="
    • "+lang.getProperty(LANG_CONTRIBUTED_BY)+":\n"; Iterator contrib = c.getMainOntology().getContributors().iterator(); while(contrib.hasNext()){ Agent currContrib = contrib.next(); @@ -553,17 +640,17 @@ public static String getProvenanceHtml(Configuration c, Properties lang){ provhtml+="
    • \n"; } if(c.getMainOntology().getLatestVersion()!=null &&!"".equals(c.getMainOntology().getLatestVersion())){ - provhtml+="
    • "+provURI+ " "+lang.getProperty("spec")+" "+ c.getMainOntology().getLatestVersion()+"
    • \n"; + provhtml+="
    • "+provURI+ " "+lang.getProperty(LANG_SPEC)+" "+ c.getMainOntology().getLatestVersion()+"
    • \n"; } if(c.getMainOntology().getPreviousVersion()!=null &&!"".equals(c.getMainOntology().getPreviousVersion())){ - provhtml+="
    • "+provURI+ " "+lang.getProperty("rev")+" "+ c.getMainOntology().getPreviousVersion()+"
    • \n"; + provhtml+="
    • "+provURI+ " "+lang.getProperty(LANG_REV)+" "+ c.getMainOntology().getPreviousVersion()+"
    • \n"; } - provhtml+="
    • "+lang.getProperty("result"); + provhtml+="
    • "+lang.getProperty(LANG_RESULT); if(c.getMainOntology().getReleaseDate()!=null &&!"".equals(c.getMainOntology().getReleaseDate())){ - provhtml+="
    • "+lang.getProperty("generated") +" "+c.getMainOntology().getReleaseDate(); + provhtml+="
    • "+lang.getProperty(LANG_GENERATED) +" "+c.getMainOntology().getReleaseDate(); } provhtml+="
    \n" + - "

    \n

    "+lang.getProperty("back")+" "+lang.getProperty("back1")+". "+lang.getProperty("back2")+"

    " + + "\n

    "+lang.getProperty(LANG_BACK)+" "+lang.getProperty(LANG_BACK1)+". "+lang.getProperty(LANG_BACK2)+"

    " + "\n \n" + ""; return provhtml; @@ -845,7 +932,7 @@ public static final String getHTACCESS(Configuration c){ */ public static String get406(Configuration c, Properties lang) { String page406 = "\n" + - "\n" + lang.getProperty("notAccPage")+"
      "; + "\n" + lang.getProperty(LANG_NOT_ACC_PAGE)+"
        "; HashMap serializations = c.getMainOntology().getSerializations(); page406+="
      • html
      • "; for(String s:serializations.keySet()){ diff --git a/src/main/java/widoco/CreateResources.java b/src/main/java/widoco/CreateResources.java index a2a1b35..e673cd7 100644 --- a/src/main/java/widoco/CreateResources.java +++ b/src/main/java/widoco/CreateResources.java @@ -16,6 +16,7 @@ package widoco; +import diff.CompareOntologies; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; @@ -90,9 +91,14 @@ public static void generateDocumentation(String outFolder, Configuration c, File if(c.isPublishProvenance()){ createProvenancePage(folderOut+File.separator+"provenance", c, languageFile); } - - //here copy the vocabulary to the right folder -// WidocoUtils.copyExternalResource(c.getOntologyPath(), new File(folderOut+File.separator+"ontology.owl")); + if(c.isIncludeChangeLog()){ + if(c.getMainOntology().getPreviousVersion()!=null &&!"".equals(c.getMainOntology().getPreviousVersion())){ + createChangeLog(folderOut+File.separator+"sections", c, languageFile); + }else{ + System.out.println("No previous version provided. No changelog produced!"); + } + } + //serialize the model in different serializations. HashMap s = c.getMainOntology().getSerializations(); for(String serialization:s.keySet()){ @@ -134,14 +140,44 @@ private static void createProvenancePage(String path, Configuration c, Propertie saveDocument(path+File.separator+"provenance-"+c.getCurrentLanguage()+".ttl", Constants.getProvenanceRDF(c),c); } + /** + * Method that creates an htaccess file for content negotiation + * @param path where to save the file + * @param c configuration with the information of the current settings + */ private static void createHTACCESSFile(String path, Configuration c){ saveDocument(path,Constants.getHTACCESS(c), c); } - + /** + * Method that creates a 406 page in case the user ir requesting an unsupported serialization + * @param path where to save the file + * @param c configuration with the information of the current settings + * @lang patameter with the language properties document with the translations + */ private static void create406Page(String path, Configuration c, Properties lang) { saveDocument(path,Constants.get406(c,lang), c); } + /** + * Method that creates the change log for the ontology, automatically. + * @param path + * @param c + * @param lang + */ + private static void createChangeLog(String path, Configuration c, Properties lang){ + try{ + System.out.println("Attempting to generate an automated changelog\nDownloading old ontology "+c.getMainOntology().getPreviousVersion()); + String oldVersionPath = c.getTmpFile().getAbsolutePath()+File.separator+"OLDOntology"; + WidocoUtils.downloadOntology(c.getMainOntology().getPreviousVersion(), oldVersionPath); + CompareOntologies comparison = new CompareOntologies(oldVersionPath, c.getOntologyPath()); + saveDocument(path+File.separator+"changelog-"+c.getCurrentLanguage()+".html", Constants.getChangeLogSection(c, comparison, lang),c); + System.out.println("Changelog successfully created"); + }catch(Exception e){ + System.out.println("Could not generate changelog: "+e.getMessage()); + } + + } + /** * Sections of the document. Each section will be a separate html file */ @@ -177,23 +213,23 @@ private static void createOverviewSection(String path, Configuration c, String c }else{ String overViewSection = Constants.getOverviewSection(c, lang); if(!"".equals(classesList) && classesList!=null){ - overViewSection+=("

        "+lang.getProperty("classes")+"

        \n"); + overViewSection+=("

        "+lang.getProperty(Constants.LANG_CLASSES)+"

        \n"); overViewSection+=(classesList); } if(!"".equals(propList) && propList!=null){ - overViewSection+=("

        "+lang.getProperty("objProp")+"

        "); + overViewSection+=("

        "+lang.getProperty(Constants.LANG_OBJ_PROP)+"

        "); overViewSection+=(propList); } if(!"".equals(dataPropList) && dataPropList!=null){ - overViewSection+=("

        "+lang.getProperty("dataProp")+"

        "); + overViewSection+=("

        "+lang.getProperty(Constants.LANG_DATA_PROP)+"

        "); overViewSection+=(dataPropList); } if(!"".equals(annotationProps) && annotationProps!=null && c.isIncludeAnnotationProperties()){ - overViewSection+=("

        "+lang.getProperty("annProp")+"

        "); + overViewSection+=("

        "+lang.getProperty(Constants.LANG_ANN_PROP)+"

        "); overViewSection+=(annotationProps); } if(!"".equals(namedIndividuals) && namedIndividuals!=null && c.isIncludeNamedIndividuals()){ - overViewSection+=("

        "+lang.getProperty("namedIndiv")+"

        "); + overViewSection+=("

        "+lang.getProperty(Constants.LANG_NAMED_INDIV)+"

        "); overViewSection+=(namedIndividuals); } saveDocument(path+File.separator+"overview-"+c.getCurrentLanguage()+".html", overViewSection,c); @@ -320,27 +356,27 @@ private static void createFolderStructure(String s, Configuration c, Properties public static void saveConfigFile(String path, Configuration conf)throws IOException{ String textProperties = "\n";//the first line I leave an intro because there have been problems. - textProperties+=Constants.abstractSectionContent+"="+conf.getAbstractSection()+"\n"; - textProperties+=Constants.ontTitle+"="+conf.getMainOntology().getTitle()+"\n"; - textProperties+=Constants.ontPrefix+"="+conf.getMainOntology().getNamespacePrefix()+"\n"; - textProperties+=Constants.ontNamespaceURI+"="+conf.getMainOntology().getNamespaceURI()+"\n"; - textProperties+=Constants.ontName+"="+conf.getMainOntology().getName()+"\n"; - textProperties+=Constants.thisVersionURI+"="+conf.getMainOntology().getThisVersion()+"\n"; - textProperties+=Constants.latestVersionURI+"="+conf.getMainOntology().getLatestVersion()+"\n"; - textProperties+=Constants.previousVersionURI+"="+conf.getMainOntology().getPreviousVersion()+"\n"; - textProperties+=Constants.dateOfRelease+"="+conf.getMainOntology().getReleaseDate()+"\n"; - textProperties+=Constants.ontologyRevision+"="+conf.getMainOntology().getRevision()+"\n"; - textProperties+=Constants.licenseURI+"="+conf.getMainOntology().getLicense().getUrl()+"\n"; - textProperties+=Constants.licenseName+"="+conf.getMainOntology().getLicense().getName()+"\n"; - textProperties+=Constants.licenseIconURL+"="+conf.getMainOntology().getLicense().getIcon()+"\n"; - textProperties+=Constants.citeAs+"="+conf.getMainOntology().getCiteAs()+"\n"; + textProperties+=Constants.ABSTRACT_SECTION_CONTENT+"="+conf.getAbstractSection()+"\n"; + textProperties+=Constants.ONT_TITLE+"="+conf.getMainOntology().getTitle()+"\n"; + textProperties+=Constants.ONT_PREFIX+"="+conf.getMainOntology().getNamespacePrefix()+"\n"; + textProperties+=Constants.ONT_NAMESPACE_URI+"="+conf.getMainOntology().getNamespaceURI()+"\n"; + textProperties+=Constants.ONT_NAME+"="+conf.getMainOntology().getName()+"\n"; + textProperties+=Constants.THIS_VERSION_URI+"="+conf.getMainOntology().getThisVersion()+"\n"; + textProperties+=Constants.LATEST_VERSION_URI+"="+conf.getMainOntology().getLatestVersion()+"\n"; + textProperties+=Constants.PREVIOUS_VERSION+"="+conf.getMainOntology().getPreviousVersion()+"\n"; + textProperties+=Constants.DATE_OF_RELEASE+"="+conf.getMainOntology().getReleaseDate()+"\n"; + textProperties+=Constants.ONTOLOGY_REVISION+"="+conf.getMainOntology().getRevision()+"\n"; + textProperties+=Constants.LICENSE_URI+"="+conf.getMainOntology().getLicense().getUrl()+"\n"; + textProperties+=Constants.LICENSE_NAME+"="+conf.getMainOntology().getLicense().getName()+"\n"; + textProperties+=Constants.LICENSE_ICON_URL+"="+conf.getMainOntology().getLicense().getIcon()+"\n"; + textProperties+=Constants.CITE_AS+"="+conf.getMainOntology().getCiteAs()+"\n"; textProperties+=Constants.DOI+"="+conf.getMainOntology().getDoi()+"\n"; textProperties+=Constants.STATUS+"="+conf.getMainOntology().getStatus()+"\n"; if(conf.getMainOntology().getPublisher()!=null){ - textProperties+=Constants.publisher+"="+conf.getMainOntology().getPublisher().getName()+"\n"; - textProperties+=Constants.publisherURI+"="+conf.getMainOntology().getPublisher().getURL()+"\n"; - textProperties+=Constants.publisherInstitution+"="+conf.getMainOntology().getPublisher().getInstitutionName()+"\n"; - textProperties+=Constants.publisherInstitutionURI+"="+conf.getMainOntology().getPublisher().getInstitutionURL()+"\n"; + textProperties+=Constants.PUBLISHER+"="+conf.getMainOntology().getPublisher().getName()+"\n"; + textProperties+=Constants.PUBLISHER_URI+"="+conf.getMainOntology().getPublisher().getURL()+"\n"; + textProperties+=Constants.PUBLISHER_INSTITUTION+"="+conf.getMainOntology().getPublisher().getInstitutionName()+"\n"; + textProperties+=Constants.PUBLISHER_INSTITUTION_URI+"="+conf.getMainOntology().getPublisher().getInstitutionURL()+"\n"; } String authors="", authorURLs="", authorInstitutions="",authorInstitutionURLs=""; ArrayList ag = conf.getMainOntology().getCreators(); @@ -362,10 +398,10 @@ public static void saveConfigFile(String path, Configuration conf)throws IOExcep if(ag.get(ag.size()-1).getInstitutionName()!=null) authorInstitutions+=ag.get(ag.size()-1).getInstitutionName(); if(ag.get(ag.size()-1).getInstitutionURL()!=null) authorInstitutionURLs+=ag.get(ag.size()-1).getInstitutionURL(); } - textProperties+=Constants.authors+"="+authors+"\n"; - textProperties+=Constants.authorsURI+"="+authorURLs+"\n"; - textProperties+=Constants.authorsInstitution+"="+authorInstitutions+"\n"; - textProperties+=Constants.authorsInstitutionURI+"="+authorInstitutionURLs+"\n"; + textProperties+=Constants.AUTHORS+"="+authors+"\n"; + textProperties+=Constants.AUTHORS_URI+"="+authorURLs+"\n"; + textProperties+=Constants.AUTHORS_INSTITUTION+"="+authorInstitutions+"\n"; + textProperties+=Constants.AUTHORS_INSTITUTION_URI+"="+authorInstitutionURLs+"\n"; ag = conf.getMainOntology().getContributors(); authors=""; @@ -389,10 +425,10 @@ public static void saveConfigFile(String path, Configuration conf)throws IOExcep if(ag.get(ag.size()-1).getInstitutionName()!=null) authorInstitutions+=ag.get(ag.size()-1).getInstitutionName(); if(ag.get(ag.size()-1).getInstitutionURL()!=null) authorInstitutionURLs+=ag.get(ag.size()-1).getInstitutionURL(); } - textProperties+=Constants.contributors+"="+authors+"\n"; - textProperties+=Constants.contributorsURI+"="+authorURLs+"\n"; - textProperties+=Constants.contributorsInstitution+"="+authorInstitutions+"\n"; - textProperties+=Constants.contributorsInstitutionURI+"="+authorInstitutionURLs+"\n"; + textProperties+=Constants.CONTRIBUTORS+"="+authors+"\n"; + textProperties+=Constants.CONTRIBUTORS_URI+"="+authorURLs+"\n"; + textProperties+=Constants.CONTRIBUTORS_INSTITUTION+"="+authorInstitutions+"\n"; + textProperties+=Constants.CONTRIBUTORS_INSTITUTION_URI+"="+authorInstitutionURLs+"\n"; String importedNames="", importedURIs=""; ArrayList imported = conf.getMainOntology().getImportedOntologies(); if(!imported.isEmpty()){ @@ -407,8 +443,8 @@ public static void saveConfigFile(String path, Configuration conf)throws IOExcep if(imported.get(imported.size()-1).getName()!=null) importedNames+=imported.get(imported.size()-1).getName(); if(imported.get(imported.size()-1).getNamespaceURI()!=null) importedURIs+=imported.get(imported.size()-1).getNamespaceURI(); } - textProperties+=Constants.importedOntologyNames+"="+importedNames+"\n"; - textProperties+=Constants.importedOntologyURIs+"="+importedURIs+"\n"; + textProperties+=Constants.IMPORTED_ONTOLOGY_NAMES+"="+importedNames+"\n"; + textProperties+=Constants.IMPORTED_ONTOLOGY_URIS+"="+importedURIs+"\n"; imported = conf.getMainOntology().getExtendedOntologies(); importedNames = ""; importedURIs = ""; @@ -424,8 +460,8 @@ public static void saveConfigFile(String path, Configuration conf)throws IOExcep if(imported.get(imported.size()-1).getName()!=null) importedNames+=imported.get(imported.size()-1).getName(); if(imported.get(imported.size()-1).getNamespaceURI()!=null) importedURIs+=imported.get(imported.size()-1).getNamespaceURI(); } - textProperties+=Constants.extendedOntologyNames+"="+importedNames+"\n"; - textProperties+=Constants.extendedOntologyURIs+"="+importedURIs+"\n"; + textProperties+=Constants.EXTENDED_ONTOLOGY_NAMES+"="+importedNames+"\n"; + textProperties+=Constants.EXTENDED_ONTOLOGY_URIS+"="+importedURIs+"\n"; //serializations HashMap serializations = conf.getMainOntology().getSerializations(); if(serializations.containsKey("RDF/XML")){ diff --git a/src/main/java/widoco/LODEParser.java b/src/main/java/widoco/LODEParser.java index b2b915f..1ed8ea5 100644 --- a/src/main/java/widoco/LODEParser.java +++ b/src/main/java/widoco/LODEParser.java @@ -131,27 +131,27 @@ private void parse(String content, Properties langFile){ if(attrID.equals("classes")){ classList = getTermList(html.item(i)); classes = nodeToString(html.item(i)); - classes = classes.replace("

        "+langFile.getProperty("classes")+"

        ", "

        "+langFile.getProperty("classes")+"

        "); + classes = classes.replace("

        "+langFile.getProperty(Constants.LANG_CLASSES)+"

        ", "

        "+langFile.getProperty(Constants.LANG_CLASSES)+"

        "); } else if(attrID.equals("objectproperties")){ propertyList =getTermList(html.item(i)); properties = (nodeToString(html.item(i))); - properties = properties.replace("

        "+langFile.getProperty("objProp")+"

        ", "

        "+langFile.getProperty("objProp")+"

        "); + properties = properties.replace("

        "+langFile.getProperty(Constants.LANG_OBJ_PROP)+"

        ", "

        "+langFile.getProperty(Constants.LANG_OBJ_PROP)+"

        "); } else if(attrID.equals("dataproperties")){ dataPropList = (getTermList(html.item(i))); dataProp = (nodeToString(html.item(i))); - dataProp = dataProp.replace("

        "+langFile.getProperty("dataProp")+"

        ", "

        "+langFile.getProperty("dataProp")+"

        "); + dataProp = dataProp.replace("

        "+langFile.getProperty(Constants.LANG_DATA_PROP)+"

        ", "

        "+langFile.getProperty(Constants.LANG_DATA_PROP)+"

        "); } else if(attrID.equals("annotationproperties")){ annotationPropList = (getTermList(html.item(i))); annotationProp = (nodeToString(html.item(i))); - annotationProp = annotationProp.replace("

        "+langFile.getProperty("annProp")+"

        ", "

        "+langFile.getProperty("annProp")+"

        "); + annotationProp = annotationProp.replace("

        "+langFile.getProperty(Constants.LANG_ANN_PROP)+"

        ", "

        "+langFile.getProperty(Constants.LANG_ANN_PROP)+"

        "); } else if(attrID.equals("namedindividuals")){ namedIndividualList = (getTermList(html.item(i))); namedIndividuals = (nodeToString(html.item(i))); - namedIndividuals = namedIndividuals.replace("

        "+langFile.getProperty("namedIndiv")+"

        ", "

        "+langFile.getProperty("namedIndiv")+"

        "); + namedIndividuals = namedIndividuals.replace("

        "+langFile.getProperty(Constants.LANG_NAMED_INDIV)+"

        ", "

        "+langFile.getProperty(Constants.LANG_NAMED_INDIV)+"

        "); } else if(attrID.equals("namespacedeclarations")){ Node namespace = html.item(i); diff --git a/src/main/java/widoco/LoadOntologyPropertiesInThread.java b/src/main/java/widoco/LoadOntologyPropertiesInThread.java index 8d665c3..850a55b 100644 --- a/src/main/java/widoco/LoadOntologyPropertiesInThread.java +++ b/src/main/java/widoco/LoadOntologyPropertiesInThread.java @@ -36,7 +36,7 @@ public LoadOntologyPropertiesInThread(Configuration c, GuiController g, boolean public void run() { //once it is loaded, load the properties in the config try{ - WidocoUtils.loadModel(c); + WidocoUtils.loadModelToDocument(c); c.loadPropertiesFromOntology(c.getMainOntology().getMainModel()); if(showGui){ pointerToMain.switchState("finishedLoading"); diff --git a/src/main/java/widoco/WidocoUtils.java b/src/main/java/widoco/WidocoUtils.java index 0a8829d..b322248 100644 --- a/src/main/java/widoco/WidocoUtils.java +++ b/src/main/java/widoco/WidocoUtils.java @@ -38,15 +38,34 @@ * @author Daniel Garijo */ public class WidocoUtils { - public static void loadModel(Configuration c){ + /** + * Method that will download the ontology to document with Widoco. + * @param c Widoco configuration object. + */ + public static void loadModelToDocument(Configuration c){ OntModel model = ModelFactory.createOntologyModel();//ModelFactory.createDefaultModel(); if(!c.isFromFile()){ - //if the vocabulary is from a URI, I download it locally. This is done - //because Jena doesn't handle https very well. - for(String serialization: Constants.vocabPossibleSerializations){ + String newOntologyPath = c.getTmpFile().getAbsolutePath()+File.separator+"Ontology"; + downloadOntology(c.getOntologyURI(), newOntologyPath); + c.setFromFile(true); + c.setOntologyPath(newOntologyPath); + } + readModel(model, c); + c.getMainOntology().setMainModel(model); + } + + /** + * Method that will download an ontology given its URI, doing content negotiation + * The ontology will be downloaded in the first serialization available + * (see Constants.POSSIBLE_VOCAB_SERIALIZATIONS) + * @param uri the URI of the ontology + * @param downloadPath path where the ontology will be saved locally. + */ + public static void downloadOntology(String uri, String downloadPath){ + for(String serialization: Constants.POSSIBLE_VOCAB_SERIALIZATIONS){ System.out.println("Attempting to download vocabulary in "+serialization); try{ - URL url = new URL(c.getOntologyURI()); + URL url = new URL(uri); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setInstanceFollowRedirects(true); @@ -72,23 +91,17 @@ public static void loadModel(Configuration c){ redirect=false; } InputStream in = (InputStream) connection.getInputStream(); - String newOntologyPath = c.getTmpFile().getAbsolutePath()+File.separator+"Ontology"; - Files.copy(in, Paths.get(newOntologyPath), StandardCopyOption.REPLACE_EXISTING); + Files.copy(in, Paths.get(downloadPath), StandardCopyOption.REPLACE_EXISTING); in.close(); - c.setFromFile(true); - c.setOntologyPath(newOntologyPath); break; //if the vocabulary is downloaded, then we don't download it for the other serializations }catch(Exception e){ System.err.println("Failed to download vocabulary in "+serialization); } } - - } - readModel(model, c); - c.getMainOntology().setMainModel(model); } /** + * Method that reads a local file and loads it into the configuration. * @param model * @param ontoPath * @param ontoURL diff --git a/src/main/java/widoco/gui/GuiController.java b/src/main/java/widoco/gui/GuiController.java index d6e9743..b3e5a05 100644 --- a/src/main/java/widoco/gui/GuiController.java +++ b/src/main/java/widoco/gui/GuiController.java @@ -178,7 +178,7 @@ else if (s.equals("-licensius")){ } if(!isFromFile)this.config.setOntologyURI(ontology); //we load the model locally so we can use it. - WidocoUtils.loadModel(config); + WidocoUtils.loadModelToDocument(config); if(getOntoMetadata){ config.loadPropertiesFromOntology(config.getMainOntology().getMainModel()); } diff --git a/src/main/java/widoco/gui/GuiStep1.java b/src/main/java/widoco/gui/GuiStep1.java index bfe2c1f..57d8d19 100644 --- a/src/main/java/widoco/gui/GuiStep1.java +++ b/src/main/java/widoco/gui/GuiStep1.java @@ -24,9 +24,7 @@ import java.awt.Dimension; import java.awt.Image; import java.io.File; -import java.io.IOException; import java.net.URL; -import javax.imageio.ImageIO; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JFileChooser; @@ -47,6 +45,11 @@ public class GuiStep1 extends javax.swing.JFrame { public GuiStep1(GuiController g) { this.g = g; initComponents(); + initializeGUI(); + + } + + private void initializeGUI(){ //loading logo Image l = g.getConfig().getWidocoLogo().getScaledInstance(widocoLogo.getWidth(), widocoLogo.getHeight(), Image.SCALE_SMOOTH); widocoLogo.setIcon(new ImageIcon(l)); @@ -85,7 +88,6 @@ public GuiStep1(GuiController g) { //to do: if we are going back, get the configuration, load the parameters. //if not, do as above. - } /** This method is called from within the constructor to diff --git a/src/main/java/widoco/gui/GuiStep2.java b/src/main/java/widoco/gui/GuiStep2.java index b7f7169..31b6709 100644 --- a/src/main/java/widoco/gui/GuiStep2.java +++ b/src/main/java/widoco/gui/GuiStep2.java @@ -58,6 +58,10 @@ public GuiStep2(GuiController g) { this.g =g; conf = g.getConfig(); initComponents(); + initializeGUI(); + } + + private void initializeGUI(){ Image l = g.getConfig().getWidocoLogo().getScaledInstance(widocoLogo.getWidth(), widocoLogo.getHeight(), Image.SCALE_SMOOTH); widocoLogo.setIcon(new ImageIcon(l)); this.setIconImage(g.getConfig().getWidocoLogoMini()); diff --git a/src/main/java/widoco/gui/GuiStep3.form b/src/main/java/widoco/gui/GuiStep3.form index 8bcd94b..2bc7afe 100644 --- a/src/main/java/widoco/gui/GuiStep3.form +++ b/src/main/java/widoco/gui/GuiStep3.form @@ -102,11 +102,11 @@ - - + + - + @@ -209,9 +209,13 @@ - + - + + + + + @@ -306,13 +310,15 @@ - + + + - + @@ -464,6 +470,11 @@ + + + + + diff --git a/src/main/java/widoco/gui/GuiStep3.java b/src/main/java/widoco/gui/GuiStep3.java index 83b6b77..23d3684 100644 --- a/src/main/java/widoco/gui/GuiStep3.java +++ b/src/main/java/widoco/gui/GuiStep3.java @@ -46,6 +46,10 @@ public class GuiStep3 extends javax.swing.JFrame { public GuiStep3(GuiController g) { this.g = g; initComponents(); + initializeGUI(); + } + + private void initializeGUI(){ Image l = g.getConfig().getWidocoLogo().getScaledInstance(widocoLogo.getWidth(), widocoLogo.getHeight(), Image.SCALE_SMOOTH); widocoLogo.setIcon(new ImageIcon(l)); this.setIconImage(g.getConfig().getWidocoLogoMini()); @@ -73,8 +77,7 @@ public GuiStep3(GuiController g) { if(!g.getConfig().isPublishProvenance())checkBoxProv.setSelected(false); checkBoxHTAccess.setSelected(true); checkBoxWebVowl.setSelected(true); - //if(g.isDiagram()) - + checkBoxAutomatedChangeLog.setSelected(true); } /** This method is called from within the constructor to @@ -118,6 +121,7 @@ private void initComponents() { customRadioButton = new javax.swing.JRadioButton(); checkBoxHTAccess = new javax.swing.JCheckBox(); checkBoxWebVowl = new javax.swing.JCheckBox(); + checkBoxAutomatedChangeLog = new javax.swing.JCheckBox(); labelDescription = new javax.swing.JLabel(); widocoLogo = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); @@ -258,6 +262,8 @@ public void mouseExited(java.awt.event.MouseEvent evt) { checkBoxWebVowl.setText("Add link to WebVowl visualization"); + checkBoxAutomatedChangeLog.setText("Include change log from last version"); + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( @@ -270,9 +276,12 @@ public void mouseExited(java.awt.event.MouseEvent evt) { .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(addImportedOntologiesCheckBox) .addGap(0, 0, Short.MAX_VALUE)) - .addComponent(checkBoxHTAccess, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE) + .addComponent(checkBoxHTAccess, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(checkBoxProv, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(checkBoxWebVowl, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(checkBoxWebVowl, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(219, 219, 219)) + .addComponent(checkBoxAutomatedChangeLog, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(104, 104, 104)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -346,12 +355,14 @@ public void mouseExited(java.awt.event.MouseEvent evt) { .addComponent(checkBoxHTAccess) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(checkBoxWebVowl) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(checkBoxAutomatedChangeLog) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(w3C) .addComponent(customRadioButton) .addComponent(jLabel1)) - .addGap(13, 13, 13)) + .addGap(10, 10, 10)) ); labelDescription.setText("Select the sections you want your document to have.
        If you have a section you want to load, click on the \"Load\" button.
        The diagram of the ontology will be created on the \"images\" folder of the documentation."); @@ -420,9 +431,9 @@ public void mouseExited(java.awt.event.MouseEvent evt) { .addComponent(jScrollPane1)) .addGroup(layout.createSequentialGroup() .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(1, 1, 1) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE))) - .addGap(13, 13, 13) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) @@ -479,6 +490,7 @@ private void saveState(){ g.getConfig().setUseImported(addImportedOntologiesCheckBox.isSelected()); g.getConfig().setCreateHTACCESS(checkBoxHTAccess.isSelected()); g.getConfig().setCreateWebVowlVisualization(checkBoxWebVowl.isSelected()); + g.getConfig().setIncludeChangeLog(checkBoxAutomatedChangeLog.isSelected()); } private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing @@ -573,6 +585,7 @@ private String loadSection(){ private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JButton cancelButton; private javax.swing.JCheckBox checkBoxAbstract; + private javax.swing.JCheckBox checkBoxAutomatedChangeLog; private javax.swing.JCheckBox checkBoxDescription; private javax.swing.JCheckBox checkBoxHTAccess; private javax.swing.JCheckBox checkBoxIntro; diff --git a/src/main/java/widoco/gui/GuiStep5.java b/src/main/java/widoco/gui/GuiStep5.java index 8ef5bfe..f3f547f 100644 --- a/src/main/java/widoco/gui/GuiStep5.java +++ b/src/main/java/widoco/gui/GuiStep5.java @@ -44,6 +44,10 @@ public class GuiStep5 extends javax.swing.JFrame { public GuiStep5(GuiController g, boolean isSkeleton) { initComponents(); this.g = g; + initializeGUI(isSkeleton); + } + + private void initializeGUI(boolean isSkeleton){ Image l = g.getConfig().getWidocoLogo().getScaledInstance(widocoLogo.getWidth(), widocoLogo.getHeight(), Image.SCALE_SMOOTH); widocoLogo.setIcon(new ImageIcon(l)); this.setIconImage(g.getConfig().getWidocoLogoMini()); diff --git a/src/main/resources/lode.zip b/src/main/resources/lode.zip index 0ee87b4..43e6455 100644 Binary files a/src/main/resources/lode.zip and b/src/main/resources/lode.zip differ diff --git a/src/main/resources/lode/extraction.xsl b/src/main/resources/lode/extraction.xsl index 07e8cf4..34735ba 100644 --- a/src/main/resources/lode/extraction.xsl +++ b/src/main/resources/lode/extraction.xsl @@ -1693,7 +1693,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - + diff --git a/src/main/resources/widoco/en.properties b/src/main/resources/widoco/en.properties index aa83145..965a3d2 100644 --- a/src/main/resources/widoco/en.properties +++ b/src/main/resources/widoco/en.properties @@ -53,4 +53,20 @@ provHead=Provenance of this page serialization=Download serialization: notAccPage=406 Not Acceptable\n\n\n

        Not Acceptable

        \n

        An appropriate representation of the requested resource could not be found on this server.

        \n Available variants: visualization=Visualization: -publisher=Publisher: \ No newline at end of file +publisher=Publisher: +changelogHead=Changes from last version +addedClass=Added classes +modifiedClass=Modified classes +deletedClass=Deleted classes +addedProp=Added properties +modifiedProp=Modified properties +deletedProp=Deleted properties +modifiedDataProp=Modified data properties +addedDataProp=Added data properties +deletedDataProp=Deleted data properties +added=Added +deleted=Deleted +subClassOf=SubClass of +subPropOf=SubProperty of +domain=Domain +range=Range \ No newline at end of file diff --git a/src/main/resources/widoco/es.properties b/src/main/resources/widoco/es.properties index f16c253..c4bd4fc 100644 --- a/src/main/resources/widoco/es.properties +++ b/src/main/resources/widoco/es.properties @@ -9,7 +9,7 @@ contributors=Colaboradores: extended=Ontologías extendidas: imported=Ontologías importadas: abstract=Síntesis -abstractPlaceHolder=Este es el lugar de colocar un resumen de la ontología. Un par de frases bastan para resumir su propósito.

        +abstractPlaceHolder=Este es el lugar donde escribir un resumen de la ontología. Un par de frases bastan para resumir su propósito.

        license=Licencia: licenseIfNull=Insertar el título de la licencia aquí licenseURLIfNull=http://tituloLicenciaSeleccionado.org @@ -27,7 +27,7 @@ crossRefTitle=Términos de crossRefTitle2= para clases, propiedades y propiedades de datos volver a índice crossRefPlaceHolder=Esta sección introduce más detalles sobre cada clase y propiedad definida por classes=Clases -objProp=Propiedades entre Objetos +objProp=Propiedades de objeto dataProp=Propiedades de datos annProp=Propiedades usadas para anotación namedIndiv=Individuos @@ -53,4 +53,20 @@ provHead=Provenance de esta página serialization=Descargar serialización: notAccPage=406 No Aceptable\n\n\n

        No Aceptable

        \n

        No se ha podido encontrar una representación adecuada para el recurso solicitado en el servidor.

        \n Variantes disponibles: visualization=Visualización: -publisher=Publicado por: \ No newline at end of file +publisher=Publicado por: +changelogHead=Cambios desde la última versión +addedClass=Nuevas clases +modifiedClass=Clases modificadas +deletedClass=Clases eliminadas +addedProp=Nuevas propiedades +modifiedProp=Propiedades modificadas +deletedProp=Propiedades eliminadas +modifiedDataProp=Propiedades de datos modificadas +addedDataProp=Nuevas propiedades de datos +deletedDataProp=Propiedades de datos eliminadas +added=Nuevo +deleted=Eliminado +subClassOf=Subclase de +subPropOf=Subpropiedad de +domain=Dominio +range=Rango \ No newline at end of file diff --git a/src/main/resources/widoco/pt.properties b/src/main/resources/widoco/pt.properties index e629d84..e910242 100644 --- a/src/main/resources/widoco/pt.properties +++ b/src/main/resources/widoco/pt.properties @@ -54,4 +54,20 @@ provHead=História desta página serialization=Descargar serializacion: notAccPage=406 Inaceitável\n\n\n

        406 Inaceitável

        \n

        Uma representação adequada do recurso solicitado não foi encontrado neste servidor.

        \n Variantes disponíveis: visualization=Display: -publisher=Editor: \ No newline at end of file +publisher=Editor: +changelogHead=Modificações da última versão +addedClass=Classes adicionadas +modifiedClass=Classes modificadas +deletedClass=Classes excluídas +addedProp=Propriedades adicionadas +modifiedProp=Propriedades modificadas +deletedProp=Propriedades excluídas +modifiedDataProp=Propriedades de dados modificadas +addedDataProp=Propriedades de dados adicionadas +deletedDataProp=Propriedades de dados excluídas +added=Adicionado +deleted=Excluído +subClassOf=Subclasse de +subPropOf=Subpropriedaded de +domain=Domínio +range=Gama \ No newline at end of file