From 3f3c970b01224372b810ccc85857f0cfdd629fed Mon Sep 17 00:00:00 2001 From: Daniel Garijo Date: Sun, 24 May 2020 20:54:39 -0700 Subject: [PATCH] Fix #303; Fix #373; Fix #375; #fix #393 --- pom.xml | 106 +-- src/main/java/diagram/DiagramGeneration.java | 7 - src/main/java/diff/CompareOntologies.java | 18 +- src/main/java/lode/LODEGeneration.java | 7 +- src/main/java/oops/OOPSevaluation.java | 701 +++++++++--------- ...ogIRIMapper.java => CatalogIRIMapper.java} | 15 +- src/main/java/widoco/Configuration.java | 11 +- src/main/java/widoco/Constants.java | 51 +- src/main/java/widoco/CreateDocInThread.java | 5 +- src/main/java/widoco/CreateResources.java | 7 +- src/main/java/widoco/LODEParser.java | 6 - src/main/java/widoco/WidocoUtils.java | 17 +- src/main/java/widoco/entities/Ontology.java | 36 +- src/main/java/widoco/gui/GuiController.java | 31 +- src/main/java/widoco/gui/GuiStep1.java | 9 +- src/main/java/widoco/gui/GuiStep2.java | 7 +- src/main/resources/widoco/cs.properties | 115 +-- src/main/resources/widoco/en.properties | 1 + src/main/resources/widoco/es.properties | 1 + src/main/resources/widoco/fr.properties | 3 +- src/main/resources/widoco/pt.properties | 5 +- src/test/java/oops/OOPSevaluationTest.java | 32 +- .../java/widoco/TestJenaCatalogIRIMapper.java | 7 +- src/test/resources/p-plan.owl | 425 +++++++++++ 24 files changed, 1028 insertions(+), 595 deletions(-) rename src/main/java/widoco/{JenaCatalogIRIMapper.java => CatalogIRIMapper.java} (95%) create mode 100644 src/test/resources/p-plan.owl diff --git a/pom.xml b/pom.xml index be82036..024b4a6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,20 +4,14 @@ es.oeg widoco jar - 1.4.13 + 1.4.14 Widoco - 1.2.16 UTF-8 1.8 1.8 1.8 - 2.11.1 - 1.3.6 - 0.10.1 - 0.9.6 - 0.2.7 @@ -28,84 +22,22 @@ 0.3.5 - - log4j - log4j - ${ver.log4j} - - - - javax.jms - jms - - - com.sun.jdmk - jmxtools - - - com.sun.jmx - jmxri - - - javax.mail - mail - - - + + org.slf4j + slf4j-api + 1.7.30 + + + org.slf4j + slf4j-simple + 1.7.30 + - - - org.apache.jena - apache-jena-libs - pom - ${jena.version} - - provided - - - lucene-core - org.apache.lucene - - - stax-api - stax - - - wstx-asl - org.codehaus.woodstox - - - log4j - log4j - - - icu4j - com.ibm.icu - - - slf4j-log4j12 - org.slf4j - - - - - - - org.apache.jena - jena-core - ${jena.version} - - - log4j - log4j - - - - + prevents that from happening. + --> net.sf.saxon Saxon-HE @@ -115,7 +47,7 @@ net.sourceforge.owlapi owlapi-distribution - 5.1.11 + 5.1.14 @@ -136,11 +68,11 @@ test - + @@ -205,11 +137,11 @@ - + jitpack.io diff --git a/src/main/java/diagram/DiagramGeneration.java b/src/main/java/diagram/DiagramGeneration.java index 3077d97..b86fbe1 100644 --- a/src/main/java/diagram/DiagramGeneration.java +++ b/src/main/java/diagram/DiagramGeneration.java @@ -27,11 +27,4 @@ public static void generateOntologyDiagram(String outFolder, Configuration c) { logger.error("FAILED TO LOAD " + e.getMessage()); } } - - // public static void main(String[] args){ - // File webvowl = new File("mydoc"+File.separator+"webvowl"); - // boolean t = webvowl.mkdirs(); - // WidocoUtils.unZipIt(Constants.WEBVOWL_RESOURCES, webvowl.getAbsolutePath()); - // } - } diff --git a/src/main/java/diff/CompareOntologies.java b/src/main/java/diff/CompareOntologies.java index 1c1a881..400e0b6 100644 --- a/src/main/java/diff/CompareOntologies.java +++ b/src/main/java/diff/CompareOntologies.java @@ -37,17 +37,17 @@ public class CompareOntologies { private final Logger logger = LoggerFactory.getLogger(this.getClass()); //classes - private ArrayList modifiedClasses = new ArrayList(); - private ArrayList newClasses = new ArrayList(); - private ArrayList deletedClasses = new ArrayList(); + 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(); + 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 ArrayList modifiedDataProperties = new ArrayList<>(); + private ArrayList newDataProperties = new ArrayList<>(); + private ArrayList deletedDataProperties = new ArrayList<>(); private String oldVersion, newVersion; diff --git a/src/main/java/lode/LODEGeneration.java b/src/main/java/lode/LODEGeneration.java index 1a0825a..2ac8a09 100644 --- a/src/main/java/lode/LODEGeneration.java +++ b/src/main/java/lode/LODEGeneration.java @@ -36,8 +36,9 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import org.apache.log4j.Logger; import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; import org.semanticweb.owlapi.io.OWLOntologyDocumentTarget; import org.semanticweb.owlapi.io.StringDocumentTarget; @@ -45,6 +46,7 @@ import org.semanticweb.owlapi.model.OWLOntologyCreationException; import org.semanticweb.owlapi.model.OWLOntologyStorageException; import org.semanticweb.owlapi.model.OWLOntologyManager; + import widoco.Configuration; /** @@ -52,8 +54,7 @@ * @author Silvio Peroni, adpated to Widoco (and modified) by Daniel Garijo */ public class LODEGeneration { - - final static Logger logger = Logger.getLogger(LODEGeneration.class); + private static final Logger logger = LoggerFactory.getLogger(LODEGeneration.class); public static String getLODEhtml(Configuration c, File lodeResources) throws Exception { try { diff --git a/src/main/java/oops/OOPSevaluation.java b/src/main/java/oops/OOPSevaluation.java index 943ced6..b5466db 100644 --- a/src/main/java/oops/OOPSevaluation.java +++ b/src/main/java/oops/OOPSevaluation.java @@ -21,370 +21,387 @@ import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; -import java.util.Collections; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.hp.hpl.jena.ontology.DatatypeProperty; -import com.hp.hpl.jena.ontology.Individual; -import com.hp.hpl.jena.ontology.ObjectProperty; -import com.hp.hpl.jena.ontology.OntClass; -import com.hp.hpl.jena.ontology.OntModel; -import com.hp.hpl.jena.ontology.OntModelSpec; -import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.rdf.model.NodeIterator; -import com.hp.hpl.jena.rdf.model.RDFNode; -import com.hp.hpl.jena.rdf.model.ResIterator; -import com.hp.hpl.jena.rdf.model.Resource; -import com.hp.hpl.jena.util.iterator.ExtendedIterator; + +import org.semanticweb.owlapi.apibinding.OWLManager; +import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; +import org.semanticweb.owlapi.model.OWLAnnotationValue; +import org.semanticweb.owlapi.model.OWLClass; +import org.semanticweb.owlapi.model.OWLDataFactory; +import org.semanticweb.owlapi.model.OWLDataProperty; +import org.semanticweb.owlapi.model.OWLNamedIndividual; +import org.semanticweb.owlapi.model.OWLObjectProperty; +import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.model.OWLOntologyCreationException; +import org.semanticweb.owlapi.model.OWLOntologyManager; +import org.semanticweb.owlapi.search.EntitySearcher; import widoco.Constants; /** - * - * @author Maria Poveda. Integrated by Daniel Garijo. + * @author Maria Poveda Villalon. + * Integrated by Daniel Garijo. */ public class OOPSevaluation { private final Logger logger = LoggerFactory.getLogger(this.getClass()); public boolean error = false; - public OntModel model = null; + private OWLOntology model = null; private int pitfallNumber; public OOPSevaluation(String content) throws IOException { - //always query by content - pitfallNumber = 0; - String request = "" + ""; - request += ""; - if (content != null && !"".equals(content)) { - request += ""; - //request += content ; - } - request += "" + "" + "RDF/XML" - + ""; - String uri = Constants.OOPS_SERVICE_URL; - URL url = new URL(uri); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setConnectTimeout(Constants.OOPS_TIME_OUT); - connection.setRequestMethod("POST"); - connection.setDoOutput(true); - connection.setRequestProperty("Connection", "Keep-Alive"); - connection.setRequestProperty("Accept", "application/xml"); - - OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream()); - wr.write(request); - - wr.flush(); - - InputStream in = (InputStream) connection.getInputStream(); - - OntModelSpec s = new OntModelSpec(OntModelSpec.OWL_MEM); - this.model = ModelFactory.createOntologyModel(s); - this.model.read(in, "http://myevaluation.org#"); - - URL url2 = new URL(uri); - HttpURLConnection connection2 = (HttpURLConnection) url2.openConnection(); - connection2.setRequestMethod("POST"); - connection2.setDoOutput(true); - connection2.setRequestProperty("Connection", "Keep-Alive"); - connection2.setRequestProperty("Accept", "application/xml"); - OutputStreamWriter wr2 = new OutputStreamWriter(connection2.getOutputStream()); - wr2.write(request); - wr2.flush(); - InputStream in2 = (InputStream) connection2.getInputStream(); - in2.close(); - wr2.close(); - - in.close(); - wr.close(); - - connection.disconnect(); - try{ - OntClass pitfallClass = model.createClass(Constants.OOPS_NS + "pitfall"); - this.pitfallNumber = model.listIndividuals(pitfallClass).toList().size(); - }catch(Exception e){ - logger.warn("Could not extract the number of pitfalls from response"); - } + //always query by content + pitfallNumber = 0; + String request = "" + ""; + request += ""; + if (content != null && !"".equals(content)) { + request += ""; + } + request += "" + "" + "RDF/XML" + + ""; + String uri = Constants.OOPS_SERVICE_URL; + URL url = new URL(uri); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setConnectTimeout(Constants.OOPS_TIME_OUT); + connection.setRequestMethod("POST"); + connection.setDoOutput(true); + connection.setRequestProperty("Connection", "Keep-Alive"); + connection.setRequestProperty("Accept", "application/xml"); + OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream()); + wr.write(request); + wr.flush(); + InputStream in = (InputStream) connection.getInputStream(); + try{ + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + model = manager.loadOntologyFromOntologyDocument(in); + OWLClass pitfall = model.getOWLOntologyManager().getOWLDataFactory().getOWLClass(Constants.OOPS_NS + "pitfall"); + this.pitfallNumber = EntitySearcher.getIndividuals(pitfall, model).collect(Collectors.toSet()).size(); + }catch(OWLOntologyCreationException e){ + logger.warn("Could not extract the number of pitfalls from response"); + } + in.close(); + wr.close(); + connection.disconnect(); + } - + + + /** + * Method that returns a String with an HTML representation of the evaluation + * @return + */ public String printEvaluation() { + String evaluationOutput = ""; + OWLDataFactory df = model.getOWLOntologyManager().getOWLDataFactory(); + OWLClass pitfallClass = df.getOWLClass(Constants.OOPS_NS + "pitfall"); + OWLDataProperty hasCodeDTP = df.getOWLDataProperty(Constants.OOPS_NS + "hasCode"); + OWLDataProperty hasNameDTP = df.getOWLDataProperty(Constants.OOPS_NS + "hasName"); + OWLDataProperty hasDescriptionDTP = df.getOWLDataProperty(Constants.OOPS_NS + "hasDescription"); + OWLDataProperty hasImportanceLevelDTP = df.getOWLDataProperty(Constants.OOPS_NS + "hasImportanceLevel"); + OWLDataProperty hasFrequencyDTP = df.getOWLDataProperty(Constants.OOPS_NS + "hasNumberAffectedElements"); + OWLObjectProperty hasAffectedElement = df.getOWLObjectProperty(Constants.OOPS_NS + "hasAffectedElement"); + OWLObjectProperty mightNotBeInverseOf = df.getOWLObjectProperty(Constants.OOPS_NS + "mightNotBeInverseOf"); + OWLObjectProperty hasEquivalentClass = df.getOWLObjectProperty(Constants.OOPS_NS + "hasEquivalentClass"); + OWLObjectProperty hasWrongEquivalentClass = df.getOWLObjectProperty(Constants.OOPS_NS + "hasWrongEquivalentClass"); + OWLObjectProperty noSuggestion = df.getOWLObjectProperty(Constants.OOPS_NS + "noSuggestion"); + OWLObjectProperty haveSameLabel = df.getOWLObjectProperty(Constants.OOPS_NS + "haveSameLabel"); + + Set pitfalls = EntitySearcher.getIndividuals(pitfallClass, model).collect(Collectors.toSet()); + logger.info("Pitfall number: " + pitfalls.size()); + if (this.pitfallNumber > 0) { + HashMap> codes = new HashMap<>(); + Object[] codesList; + Iterator pitfallIt = pitfalls.iterator(); + while (pitfallIt.hasNext()){ + OWLNamedIndividual pit = pitfallIt.next(); + EntitySearcher.getAnnotationAssertionAxioms(pit, model).forEach(i ->{ + if(i.getProperty().getIRI().equals(hasCodeDTP.getIRI())){ + String code = i.getValue().asLiteral().get().getLiteral(); + ArrayList pitfallsWithCode; + if(codes.containsKey(code)){ + pitfallsWithCode = codes.get(code); + pitfallsWithCode.add(pit); + }else{ + pitfallsWithCode = new ArrayList<>(); + pitfallsWithCode.add(pit); + codes.put(code,pitfallsWithCode); + } + //System.out.println(i.getProperty().getIRI()+"----" +i.getValue().toString()); + } + }); + } - String evaluationOutput = ""; - - OntClass pitfallClass = model.createClass(Constants.OOPS_NS + "pitfall"); - DatatypeProperty hasCodeDTP = model.createDatatypeProperty(Constants.OOPS_NS + "hasCode"); - // DatatypeProperty hasTitleDTP = model.createDatatypeProperty( oops + - // "hasTitle"); - DatatypeProperty hasNameDTP = model.createDatatypeProperty(Constants.OOPS_NS + "hasName"); - DatatypeProperty hasDescriptionDTP = model.createDatatypeProperty(Constants.OOPS_NS + "hasDescription"); - DatatypeProperty hasImportanceLevelDTP = model.createDatatypeProperty(Constants.OOPS_NS + "hasImportanceLevel"); - DatatypeProperty hasFrequencyDTP = model.createDatatypeProperty(Constants.OOPS_NS + "hasNumberAffectedElements"); - ObjectProperty hasAffectedElement = model.createObjectProperty(Constants.OOPS_NS + "hasAffectedElement"); - ObjectProperty mightNotBeInverseOf = model.createObjectProperty(Constants.OOPS_NS + "mightNotBeInverseOf"); - ObjectProperty hasEquivalentClass = model.createObjectProperty(Constants.OOPS_NS + "hasEquivalentClass"); - ObjectProperty hasWrongEquivalentClass = model.createObjectProperty(Constants.OOPS_NS + "hasWrongEquivalentClass"); - ObjectProperty noSuggestion = model.createObjectProperty(Constants.OOPS_NS + "noSuggestion"); - ObjectProperty haveSameLabel = model.createObjectProperty(Constants.OOPS_NS + "haveSameLabel"); - - ExtendedIterator p = model.listIndividuals(pitfallClass); - List plist = p.toList(); - logger.info("Pitfall number: " + plist.size()); - - if (plist.size() > 0) { - - // prepare for order list - - List codesL = new ArrayList<>(); - - for (int k = 0; k < plist.size(); k++) { - if (plist.get(k).hasProperty(hasCodeDTP)) { - codesL.add(plist.get(k).getPropertyValue(hasCodeDTP).asLiteral().getString()); - } else { - logger.info("The pitfall does not have CODE: " + plist.get(k).getURI()); - } - } - - Collections.sort(codesL); - - evaluationOutput = evaluationOutput + "

Evaluation results

\n"; - evaluationOutput = evaluationOutput + "
\n"; - - int i = 0; - for (String temp : codesL) { - // Individual ind = plist.get(i); - ResIterator resources = model.listSubjectsWithProperty(hasCodeDTP, temp); - - if (resources.hasNext()) { - Individual ind = resources.next().as(Individual.class); - - - String title = ind.getPropertyValue(hasNameDTP).asLiteral().getString(); - String code = ind.getPropertyValue(hasCodeDTP).asLiteral().getString(); - String description = ind.getPropertyValue(hasDescriptionDTP).asLiteral().getString(); - String importanceLevel = ind.getPropertyValue(hasImportanceLevelDTP).asLiteral().getString(); - - boolean hasFrequency = ind.hasProperty(hasFrequencyDTP); - int frequency = 0; - - if (hasFrequency) { - frequency = ind.getPropertyValue(hasFrequencyDTP).asLiteral().getInt(); - } - - evaluationOutput = evaluationOutput + "
\n"; - evaluationOutput = evaluationOutput + "
\n"; - evaluationOutput = evaluationOutput + "

\n"; - evaluationOutput = evaluationOutput + "\n"; - evaluationOutput = evaluationOutput + code + ". " + title; - - // frequency and important level - // evaluationOutput = evaluationOutput + "\n"; - - // place stuff at the right - evaluationOutput = evaluationOutput + ""; - - if (code.contentEquals("P03") || code.contentEquals("P10") || code.contentEquals("P22") - || code.contentEquals("P36") || code.contentEquals("P37") || code.contentEquals("P38") - || code.contentEquals("P39")) { - evaluationOutput = evaluationOutput + " ontology *"; - } else if (frequency == 1) { - evaluationOutput = evaluationOutput + frequency + " case detected. "; - - } else { - evaluationOutput = evaluationOutput + frequency + " cases detected. "; - } - - if (importanceLevel.equalsIgnoreCase("critical")) { - evaluationOutput = evaluationOutput + "" + importanceLevel - + ""; - } else if (importanceLevel.equalsIgnoreCase("important")) { - evaluationOutput = evaluationOutput + "" + importanceLevel - + ""; - } else if (importanceLevel.equalsIgnoreCase("minor")) { - evaluationOutput = evaluationOutput + "" + importanceLevel - + ""; - } - - // end stuff at right - evaluationOutput = evaluationOutput + ""; - - evaluationOutput = evaluationOutput + "\n"; - evaluationOutput = evaluationOutput + "

\n"; - evaluationOutput = evaluationOutput + "
\n"; - evaluationOutput = evaluationOutput + "
\n"; - evaluationOutput = evaluationOutput + "
\n"; - // descripcion - evaluationOutput = evaluationOutput + "

" + description + "

"; - - // affected elements - if (code.contentEquals("P10") || code.contentEquals("P22") || code.contentEquals("P37") - || code.contentEquals("P38") || code.contentEquals("P39")) { - evaluationOutput = evaluationOutput + "

" - + "*This pitfall applies to the ontology in general instead of specific elements" - + "

"; - } else if (code.contentEquals("P03")) { - Resource affectedE = ind.getPropertyResourceValue(hasAffectedElement); - evaluationOutput = evaluationOutput + "

" + "The property " + "" + affectedE.getURI() + "" - + " might be replaced by an ontology language predicate as for example " - + "\"rdf:type\" or \"rdfs:subclassOf\" or \"owl:sameAs\"" + "

"; - } - else if (code.contentEquals("P36")) { - evaluationOutput = evaluationOutput + "

" - + "*This pitfall applies to the ontology in general instead of specific elements and it appears in the ontology URI." - // + "" + this.uriOnto + "" - + "

"; - } - - else { - evaluationOutput = evaluationOutput + "

" - + "This pitfall affects to the following ontology elements: " + "

"; - if (code.contentEquals("P05")) { - NodeIterator elements = ind.listPropertyValues(mightNotBeInverseOf); - - evaluationOutput = evaluationOutput + "
    "; - - while (elements.hasNext()) { - String uri = elements.next().asResource().getURI(); - Individual indi = model.getIndividual(uri); - - NodeIterator elementos = indi.listPropertyValues(hasAffectedElement); - String first = elementos.next().asLiteral().getString(); - String second = elementos.next().asLiteral().getString(); - evaluationOutput = evaluationOutput + "
  • " + "" + first + "" + " may not be inverse of " - + "" + second + "" + "
  • "; - } - - evaluationOutput = evaluationOutput + "
"; - } else if (code.contentEquals("P13")) { - - NodeIterator elements = ind.listPropertyValues(noSuggestion); - - evaluationOutput = evaluationOutput + "
    "; - - while (elements.hasNext()) { - String uri = elements.next().asResource().getURI(); - Individual indi = model.getIndividual(uri); - - NodeIterator elementos = indi.listPropertyValues(hasAffectedElement); - while (elementos.hasNext()) { - String first = elementos.next().asLiteral().getString(); - evaluationOutput = evaluationOutput + "
  • " + "" + first + "" + "
  • "; - } - } - - evaluationOutput = evaluationOutput + "
      "; - - } else if (code.contentEquals("P30")) { - - NodeIterator elements = ind.listPropertyValues(hasEquivalentClass); - - evaluationOutput = evaluationOutput + "
        "; - - while (elements.hasNext()) { - String uri = elements.next().asResource().getURI(); - Individual indi = model.getIndividual(uri); - - NodeIterator elementos = indi.listPropertyValues(hasAffectedElement); - - String first = elementos.next().asLiteral().getString(); - String second = elementos.next().asLiteral().getString(); - evaluationOutput = evaluationOutput + "
      • " + "" + first + "" + " , " + "" + second + "" + "
      • "; - } - - evaluationOutput = evaluationOutput + "
          "; - - } else if (code.contentEquals("P31")) { - - NodeIterator elements = ind.listPropertyValues(hasWrongEquivalentClass); - - evaluationOutput = evaluationOutput + "
            "; - - while (elements.hasNext()) { - String uri = elements.next().asResource().getURI(); - Individual indi = model.getIndividual(uri); - - NodeIterator elementos = indi.listPropertyValues(hasAffectedElement); - - String first = elementos.next().asLiteral().getString(); - String second = elementos.next().asLiteral().getString(); - evaluationOutput = evaluationOutput + "
          • " + "" + first + "" + " , " + "" + second + "" + "
          • "; - } - - evaluationOutput = evaluationOutput + "
              "; - - } else if (code.contentEquals("P32")) { - - NodeIterator elements = ind.listPropertyValues(haveSameLabel); - - evaluationOutput = evaluationOutput + "
                "; - - while (elements.hasNext()) { - String uri = elements.next().asResource().getURI(); - Individual indi = model.getIndividual(uri); - - NodeIterator elementos = indi.listPropertyValues(hasAffectedElement); - evaluationOutput = evaluationOutput + "
              • "; - boolean primero = true; - while (elementos.hasNext()) { - String first = elementos.next().asLiteral().getString(); - if (!primero) - evaluationOutput = evaluationOutput + " , "; - evaluationOutput = evaluationOutput + "" - + first + ""; - primero = false; - } - evaluationOutput = evaluationOutput + "
              • "; - } - - evaluationOutput = evaluationOutput + "
                  "; - - } else { - NodeIterator elements = ind.listPropertyValues(hasAffectedElement); - - evaluationOutput = evaluationOutput + "
                    "; - - while (elements.hasNext()) { - RDFNode nextNode = elements.next(); - - if (nextNode.isLiteral()) { - String element = nextNode.asLiteral().getString(); - evaluationOutput = evaluationOutput + "
                  • " + "" + element + "" + "
                  • "; - } else if (nextNode.isURIResource()) { - System.out.println("Es un Resource in OOPSevaluation"); - - } else { - System.out.println("Can't act as Individual in OOPSevaluation"); - } - - } - evaluationOutput = evaluationOutput + "
                  "; - } - } - - evaluationOutput = evaluationOutput + "
\n"; - evaluationOutput = evaluationOutput + "
\n"; - evaluationOutput = evaluationOutput + "
\n"; - - i++; - } - } - evaluationOutput = evaluationOutput + "
\n"; // close div accordion - } else { - evaluationOutput = "

Congratulations! OOPS did not find a single pitfall

"; - } + codesList = codes.keySet().toArray(); + Arrays.sort(codesList); + + evaluationOutput = evaluationOutput + "

Evaluation results

\n"; + evaluationOutput = evaluationOutput + "
\n"; + + int i = 0; + for (Object temp : codesList) { + ArrayList resources = codes.get((String)temp); + for (OWLNamedIndividual ind:resources){ + String title=""; + String code = (String) temp; + String description = ""; + String importanceLevel = ""; + String affectedElement =""; + int frequency = 0; + + try{ + List properties = EntitySearcher.getAnnotationAssertionAxioms(ind, model).collect(Collectors.toList()); + for (OWLAnnotationAssertionAxiom p: properties){ + if(p.getProperty().getIRI().equals(hasNameDTP.getIRI())){ + title = p.getValue().asLiteral().get().getLiteral(); + }else if (p.getProperty().getIRI().equals(hasDescriptionDTP.getIRI())){ + description = p.getValue().asLiteral().get().getLiteral(); + }else if (p.getProperty().getIRI().equals(hasImportanceLevelDTP.getIRI())){ + importanceLevel = p.getValue().asLiteral().get().getLiteral(); + }else if (p.getProperty().getIRI().equals(hasFrequencyDTP.getIRI())){ + frequency = p.getValue().asLiteral().get().parseInteger(); + }else if (p.getProperty().getIRI().equals(hasAffectedElement.getIRI())){ + affectedElement = p.getValue().asIRI().toString(); + } + } + }catch(Exception e){ + logger.error("Error while extracting some of the properties for the pitfall: "+code); + } + + evaluationOutput = evaluationOutput + "
\n"; + evaluationOutput = evaluationOutput + "
\n"; + evaluationOutput = evaluationOutput + "

\n"; + evaluationOutput = evaluationOutput + "\n"; + evaluationOutput = evaluationOutput + code + ". " + title; + + // frequency and important level + // evaluationOutput = evaluationOutput + "\n"; + + // place stuff at the right + evaluationOutput = evaluationOutput + ""; +// + if (code.contentEquals("P03") || code.contentEquals("P10") || code.contentEquals("P22") + || code.contentEquals("P36") || code.contentEquals("P37") || code.contentEquals("P38") + || code.contentEquals("P39")) { + evaluationOutput = evaluationOutput + " ontology *"; + } else if (frequency == 1) { + evaluationOutput = evaluationOutput + frequency + " case detected. "; + + } else { + evaluationOutput = evaluationOutput + frequency + " cases detected. "; + } +// + if (importanceLevel.equalsIgnoreCase("critical")) { + evaluationOutput = evaluationOutput + "" + importanceLevel + + ""; + } else if (importanceLevel.equalsIgnoreCase("important")) { + evaluationOutput = evaluationOutput + "" + importanceLevel + + ""; + } else if (importanceLevel.equalsIgnoreCase("minor")) { + evaluationOutput = evaluationOutput + "" + importanceLevel + + ""; + } + + // end stuff at right + evaluationOutput = evaluationOutput + ""; + + evaluationOutput = evaluationOutput + "\n"; + evaluationOutput = evaluationOutput + "

\n"; + evaluationOutput = evaluationOutput + "
\n"; + evaluationOutput = evaluationOutput + "
\n"; + evaluationOutput = evaluationOutput + "
\n"; + // descripcion + evaluationOutput = evaluationOutput + "

" + description + "

"; + + // affected elements + if (code.contentEquals("P10") || code.contentEquals("P22") || code.contentEquals("P37") + || code.contentEquals("P38") || code.contentEquals("P39")) { + evaluationOutput = evaluationOutput + "

" + + "*This pitfall applies to the ontology in general instead of specific elements" + + "

"; + } else if (code.contentEquals("P03")) { +// Resource affectedE = ind.getPropertyResourceValue(hasAffectedElement); + evaluationOutput = evaluationOutput + "

" + "The property " + "" + affectedElement + "" + + " might be replaced by an ontology language predicate as for example " + + "\"rdf:type\" or \"rdfs:subclassOf\" or \"owl:sameAs\"" + "

"; + } + else if (code.contentEquals("P36")) { + evaluationOutput = evaluationOutput + "

" + + "*This pitfall applies to the ontology in general instead of specific elements and it appears in the ontology URI." + // + "" + this.uriOnto + "" + + "

"; + } + else { + evaluationOutput = evaluationOutput + "

" + + "This pitfall affects to the following ontology elements: " + "

"; + try{ + switch (code) { + case "P05": + { + List elements = EntitySearcher.getAnnotationAssertionAxioms(ind, model).filter + (prop -> prop.getProperty().getIRI(). + equals(mightNotBeInverseOf.getIRI())). + collect(Collectors.toList()); + evaluationOutput = evaluationOutput + "
    "; + for (OWLAnnotationAssertionAxiom element:elements) { + Iterator elementos = (EntitySearcher.getAnnotationAssertionAxioms(element.getValue().asIRI().get(), model).filter + (prop -> prop.getProperty().getIRI(). + equals(hasAffectedElement.getIRI())). + collect(Collectors.toList())).iterator(); + if(elementos.hasNext()){ + String first = ((OWLAnnotationAssertionAxiom)elementos.next()).getValue().asLiteral().get().getLiteral(); + String second = ((OWLAnnotationAssertionAxiom)elementos.next()).getValue().asLiteral().get().getLiteral(); + evaluationOutput = evaluationOutput + "
  • " + "" + first + "" + " may not be inverse of " + + "" + second + "" + "
  • "; + evaluationOutput = evaluationOutput + "
"; + } + } + break; + } + case "P13": + { + List elements = EntitySearcher.getAnnotationAssertionAxioms(ind, model).filter + (prop -> prop.getProperty().getIRI(). + equals(noSuggestion.getIRI())). + collect(Collectors.toList()); + evaluationOutput = evaluationOutput + "
    "; + for (OWLAnnotationAssertionAxiom element:elements) { + Iterator elementos = (EntitySearcher.getAnnotationAssertionAxioms(element.getValue().asIRI().get(), model).filter + (prop -> prop.getProperty().getIRI(). + equals(hasAffectedElement.getIRI())). + collect(Collectors.toList())).iterator(); + while(elementos.hasNext()) { + String first = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString(); + evaluationOutput = evaluationOutput + "
  • " + "" + first + "" + "
  • "; + } + } + evaluationOutput = evaluationOutput + "
"; + break; + } + case "P30": + { + List elements = EntitySearcher.getAnnotationAssertionAxioms(ind, model).filter + (prop -> prop.getProperty().getIRI(). + equals(hasEquivalentClass.getIRI())). + collect(Collectors.toList()); + evaluationOutput = evaluationOutput + "
    "; + for (OWLAnnotationAssertionAxiom element:elements) { + Iterator elementos = (EntitySearcher.getAnnotationAssertionAxioms(element.getValue().asIRI().get(), model).filter + (prop -> prop.getProperty().getIRI(). + equals(hasAffectedElement.getIRI())). + collect(Collectors.toList())).iterator(); + while(elementos.hasNext()) { + String first = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString(); + String second = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString(); + evaluationOutput = evaluationOutput + "
  • " + "" + first + "" + " , " + "" + second + "" + "
  • "; + } + evaluationOutput = evaluationOutput + "
"; + } + break; + } + case "P31": + { + List elements = EntitySearcher.getAnnotationAssertionAxioms(ind, model).filter + (prop -> prop.getProperty().getIRI(). + equals(hasWrongEquivalentClass.getIRI())). + collect(Collectors.toList()); + evaluationOutput = evaluationOutput + "
    "; + for (OWLAnnotationAssertionAxiom element:elements) { + Iterator elementos = (EntitySearcher.getAnnotationAssertionAxioms(element.getValue().asIRI().get(), model).filter + (prop -> prop.getProperty().getIRI(). + equals(hasAffectedElement.getIRI())). + collect(Collectors.toList())).iterator(); + while(elementos.hasNext()) { + String first = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString(); + String second = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString(); + evaluationOutput = evaluationOutput + "
  • " + "" + first + "" + " , " + "" + second + "" + "
  • "; + } + evaluationOutput = evaluationOutput + "
"; + } + break; + } + case "P32": + { + List elements = EntitySearcher.getAnnotationAssertionAxioms(ind, model).filter + (prop -> prop.getProperty().getIRI(). + equals(haveSameLabel.getIRI())). + collect(Collectors.toList()); + evaluationOutput = evaluationOutput + "
    "; + for (OWLAnnotationAssertionAxiom element:elements) { + Iterator elementos = (EntitySearcher.getAnnotationAssertionAxioms(element.getValue().asIRI().get(), model).filter + (prop -> prop.getProperty().getIRI(). + equals(hasAffectedElement.getIRI())). + collect(Collectors.toList())).iterator(); + boolean primero = true; + while(elementos.hasNext()) { + String first = ((OWLAnnotationAssertionAxiom) elementos.next()).getValue().asLiteral().get().toString(); + if (!primero) + evaluationOutput = evaluationOutput + " , "; + evaluationOutput = evaluationOutput + "" + + first + ""; + primero = false; + } + evaluationOutput = evaluationOutput + ""; + } + evaluationOutput = evaluationOutput + "
"; + break; + } + default: + { + List elements = EntitySearcher.getAnnotationAssertionAxioms(ind, model).filter + (prop -> prop.getProperty().getIRI(). + equals(hasAffectedElement.getIRI())). + collect(Collectors.toList()); + evaluationOutput = evaluationOutput + "
    "; + for (OWLAnnotationAssertionAxiom elem:elements) { + OWLAnnotationValue e = ((OWLAnnotationAssertionAxiom)elem).getValue(); + if(e.isLiteral()){ + String element = e.asLiteral().get().toString(); + evaluationOutput = evaluationOutput + "
  • " + "" + element + "" + "
  • "; + }else{ + logger.warn("Can't act as Individual in OOPSevaluation"); + } + } + evaluationOutput = evaluationOutput + "
"; + break; + } + } + }catch(Exception e){ + logger.warn("Error when processing one of the pitfalls: "+e.getMessage()); + } + } + + evaluationOutput = evaluationOutput + "
\n"; + evaluationOutput = evaluationOutput + "
\n"; + evaluationOutput = evaluationOutput + "
\n"; + + i++; + } + } + evaluationOutput = evaluationOutput + "
\n"; // close div accordion + } else { + evaluationOutput = "

Congratulations! OOPS did not find a single pitfall

"; + } - return evaluationOutput; + return evaluationOutput; } diff --git a/src/main/java/widoco/JenaCatalogIRIMapper.java b/src/main/java/widoco/CatalogIRIMapper.java similarity index 95% rename from src/main/java/widoco/JenaCatalogIRIMapper.java rename to src/main/java/widoco/CatalogIRIMapper.java index 31f53b9..362b4d9 100644 --- a/src/main/java/widoco/JenaCatalogIRIMapper.java +++ b/src/main/java/widoco/CatalogIRIMapper.java @@ -1,6 +1,7 @@ package widoco; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.io.FileDocumentSource; import org.semanticweb.owlapi.io.OWLOntologyDocumentSource; @@ -21,15 +22,15 @@ * read all OntologySpec elements and add their publicURI and altURL to a map which is then used to do the conversion * from ontologyIRI or versionIRI to documentIRI. * - * Using OWLAPI to read one XML file is overkill but we do it anyway because it could then support any serialisation + * Using OWLAPI to read one XML file is overkill but we do it anyway because it could then support any serialization * format, not only ont-policy.rdf but also .ttl etc. And we didn't want to do it with Jena because that dependency * should not be part of widoco in a future version (perhaps?) * * @author Jacobus Geluk, agnos.ai */ -public class JenaCatalogIRIMapper implements OWLOntologyIRIMapper { +public class CatalogIRIMapper implements OWLOntologyIRIMapper { - final static Logger logger = Logger.getLogger(JenaCatalogIRIMapper.class); + private static final Logger logger = LoggerFactory.getLogger(CatalogIRIMapper.class); // // Some static variables that have been copied straight from the Jena code that deals with ont-policy.rdf @@ -51,7 +52,7 @@ public class JenaCatalogIRIMapper implements OWLOntologyIRIMapper { private OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); - JenaCatalogIRIMapper() { + CatalogIRIMapper() { logger.info("Creating JenaCatalogIRIMapper"); @@ -142,7 +143,7 @@ void setIRI(IRI predicateIRI, IRI valueIRI) { .filter(annotationAssertionAxiom -> AxiomSubjectProviderEx.getSubject(annotationAssertionAxiom).isIndividual() ) - .filter(JenaCatalogIRIMapper::isMappingIRI) + .filter(CatalogIRIMapper::isMappingIRI) // .peek(axiom -> logger.info("Axiom " + axiom.toString() + " type " + axiom.getAxiomType().getName())) .forEach(annotationAssertionAxiom -> getIdOfAxiom(annotationAssertionAxiom).ifPresent(axiomId -> @@ -170,7 +171,7 @@ private OWLOntology loadOntologyFromOntologyDocument(OWLOntologyDocumentSource d private static Optional ontologyDocumentSource() { return ontPolicyLocations() - .filter(JenaCatalogIRIMapper::fileExists) + .filter(CatalogIRIMapper::fileExists) .peek(fileName -> logger.info("Loading 1 " + fileName)) .map(fileName -> new File(fileName)) .findFirst() diff --git a/src/main/java/widoco/Configuration.java b/src/main/java/widoco/Configuration.java index 781e402..6244ceb 100644 --- a/src/main/java/widoco/Configuration.java +++ b/src/main/java/widoco/Configuration.java @@ -371,10 +371,6 @@ private void loadPropertyFile(String path) throws IOException { logger.warn("Error while reading configuration properties from [" + path + "]: " + ex.getMessage()); throw ex; } - // } catch (Exception ex) { - // logger.error("Error while reading configuration properties " + - // ex.getMessage()); - // } } /** @@ -466,8 +462,6 @@ private String appendDetails(final String detail, final String prefix, final boo } private void completeMetadata(OWLAnnotation a) { - // this.currentLanguage - // System.out.println(a.toString()); String propertyName = a.getProperty().getIRI().getIRIString(); String value; String valueLanguage; @@ -503,6 +497,7 @@ private void completeMetadata(OWLAnnotation a) { case Constants.PROP_DCTERMS_DESCRIPTION: case Constants.PROP_DC_DESCRIPTION: case Constants.PROP_SCHEMA_DESCRIPTION: + case Constants.PROP_RDFS_COMMENT: case Constants.PROP_SKOS_NOTE: try { valueLanguage = a.getValue().asLiteral().get().getLang(); @@ -637,6 +632,10 @@ private void completeMetadata(OWLAnnotation a) { value = WidocoUtils.getValueAsLiteralOrURI(a.getValue()); mainOntologyMetadata.setBackwardsCompatibleWith(value); break; + case Constants.PROP_OWL_INCOMPATIBLE: + value = WidocoUtils.getValueAsLiteralOrURI(a.getValue()); + mainOntologyMetadata.setIncompatibleWith(value); + break; } } diff --git a/src/main/java/widoco/Constants.java b/src/main/java/widoco/Constants.java index a017e85..d58cc87 100644 --- a/src/main/java/widoco/Constants.java +++ b/src/main/java/widoco/Constants.java @@ -87,6 +87,7 @@ public class Constants { public static final String PROP_OWL_VERSION_INFO = NS_OWL + "versionInfo"; public static final String PROP_OWL_PRIOR_VERSION = NS_OWL + "priorVersion"; public static final String PROP_OWL_BACKWARDS_COMPATIBLE = NS_OWL + "backwardCompatibleWith"; + public static final String PROP_OWL_INCOMPATIBLE = NS_OWL + "incompatibleWith"; public static final String PROP_DC_TITLE = NS_DC + "title"; public static final String PROP_DC_RIGHTS = NS_DC + "rights"; @@ -236,6 +237,7 @@ public class Constants { public static final String LANG_NAMED_INDIV = "namedIndiv"; public static final String LANG_TABLE_OF_CONTENTS = "tableOfContents"; public static final String LANG_COMPATIBLE = "compatible"; + public static final String LANG_INCOMPATIBLE = "incompatible"; public static final String LANG_LEGEND = "legend"; // labels for the changelog @@ -257,6 +259,45 @@ public class Constants { public static final String LANG_RANGE = "range"; public static final String LANG_UNION = "unionOf"; public static final String LANG_INTERSECTION = "intersectionOf"; + public static final String HELP_TEXT ="java -jar widoco-VERSION-jar-with-dependencies.jar [OPTIONS]\n" + +"\n" + +"OPTIONS:\n" + +" -ontFile PATH [required (unless -ontURI is used)]: Load a local ontology file (from PATH) to document.\n " + + " This option is incompatible with -ontURI\n" + +" -ontURI URI [required (unless -ontFile is used)]: Load an ontology to document from its URI.\n" + + " This option is incompatible with -ontFile\n" + +" -outFolder folderName: Specifies the name of the folder where to save the documentation.\n" + + " Default name is 'myDocumentation'\n" + +" -confFile PATH: Load your own configuration file for the ontology metadata.\n" + + " Incompatible with -getOntologyMetadata\n" + +" -getOntologyMetadata: Extract ontology metadata from the given ontology \n" + +" -oops: Create an html page with the evaluation from the OOPS service (http://oops.linkeddata.es/)\n" + +" -rewriteAll: Replace any existing files when documenting an ontology (e.g., from a previous execution)\n" + +" -crossRef: ONLY generate the overview and cross reference sections. The index document will NOT be generated.\n" + + " The htaccess, provenance page, etc., will not be generated unless requested by other flags.\n" + + " This flag is intended to be used only after a first version of the documentation exists.\n" + +" -saveConfig PATH: Save a configuration file on PATH with the properties of a given ontology\n" + +" -useCustomStyle: Export the documentation using alternate css files (by Daniel Vila).\n" + +" -lang LANG1-LANG2: Generate documentation in multiple languages (separated by \"-\").\n" + + " Note that if the language is not supported, the system will load the labels in english.\n" + + " Usage example: en-pt-es\n" + +" -includeImportedOntologies: Indicates whether the terms of the imported ontologies of the current ontology\n" + + " should be documented as well or not.\n" + +" -htaccess: Create a bundle for publication ready to be deployed on your Apache server.\n" + +" -webVowl: Create a visualization based on WebVowl in the documentation.\n" + +" -licensius: Use the Licensius web services to retrieve license metadata.\n" + + " Only works if the -getOntologyMetadata flag is enabled.\n" + +" -ignoreIndividuals: Individuals will not be included in the documentation.\n" + +" -includeAnnotationProperties: Include annotation properties in the documentation\n" + +" -analytics CODE: Add a code snippet for Google analytics to track your HTML documentation.\n" + + " You need to add your CODE next to the flag. For example: UA-1234\n" + +" -doNotDisplaySerializations: The serializations of the ontology will not be displayed.\n" + +" -displayDirectImportsOnly: Include direct imports of the ontology in your documentation.\n" + +" -rewriteBase PATH: Change the default rewrite base path. The default value is \"/\".\n" + + " This flag can only be used with the htaccess option.\n" + +" -excludeIntroduction: Skip the introduction section in the documentation. \n" + +" -uniteSections: Write all HTML sections into a single HTML document. \n" + +" -- help: Shows this message and exit.\n"; /** * Head section of the HTML document. @@ -833,6 +874,12 @@ public static String getHeadSection(Configuration c, Properties l) { head += "
" + l.getProperty(LANG_COMPATIBLE) + ":
\n
" + c.getMainOntology().getBackwardsCompatibleWith() + "
\n"; } + if (!"".equals(c.getMainOntology().getIncompatibleWith()) + && c.getMainOntology().getIncompatibleWith() != null) { + // doi is common for all languages + head += "
" + l.getProperty(LANG_INCOMPATIBLE) + ":
\n
" + + c.getMainOntology().getIncompatibleWith() + "
\n"; + } // end definition list head += "\n\n"; @@ -927,7 +974,9 @@ public static String getProvenanceRDF(Configuration c) { provURI = "..\\index-" + c.getCurrentLanguage() + ".html"; } String provrdf = "@prefix prov: .\n" - + "@prefix dc: .\n" + "@prefix foaf: .\n"; + + "@prefix dc: .\n" + + "@prefix foaf: .\n" + + "@prefix : <> .\n"; provrdf += "<" + provURI + "> a prov:Entity;\n"; if (c.getMainOntology().getTitle() != null && !"".equals(c.getMainOntology().getTitle())) { provrdf += "\t dc:title \"" + c.getMainOntology().getTitle() + "\";\n"; diff --git a/src/main/java/widoco/CreateDocInThread.java b/src/main/java/widoco/CreateDocInThread.java index bc6fd43..8e6d351 100644 --- a/src/main/java/widoco/CreateDocInThread.java +++ b/src/main/java/widoco/CreateDocInThread.java @@ -17,7 +17,8 @@ import java.io.File; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import widoco.gui.GuiController; /** @@ -29,7 +30,7 @@ public class CreateDocInThread implements Runnable{ private final GuiController pointerToMain; private final File tmpFile; - final static Logger logger = Logger.getLogger(CreateDocInThread.class); + private static final Logger logger = LoggerFactory.getLogger(CreateDocInThread.class); public CreateDocInThread(Configuration c, GuiController g, File lodeTmpResources){ this.c = c; diff --git a/src/main/java/widoco/CreateResources.java b/src/main/java/widoco/CreateResources.java index bb25b36..a618f95 100644 --- a/src/main/java/widoco/CreateResources.java +++ b/src/main/java/widoco/CreateResources.java @@ -29,7 +29,8 @@ import java.util.Properties; import javax.swing.JOptionPane; import lode.LODEGeneration; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.semanticweb.owlapi.formats.NTriplesDocumentFormat; import org.semanticweb.owlapi.formats.RDFJsonLDDocumentFormat; import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; @@ -47,7 +48,7 @@ */ public class CreateResources { - final static Logger logger = Logger.getLogger(CreateResources.class); + private static final Logger logger = LoggerFactory.getLogger(CreateResources.class); public static void generateDocumentation(String outFolder, Configuration c, File lodeResources) throws Exception { String lodeContent; @@ -113,7 +114,7 @@ public static void generateDocumentation(String outFolder, Configuration c, File && !"".equals(c.getMainOntology().getPreviousVersion())) { changeLog = createChangeLog(folderOut + File.separator + "sections", c, languageFile); } else { - System.out.println("No previous version provided. No changelog produced!"); + logger.info("No previous version provided. No changelog produced!"); } } if (c.isCreateWebVowlVisualization()) { diff --git a/src/main/java/widoco/LODEParser.java b/src/main/java/widoco/LODEParser.java index cf44e01..d3ff8f9 100644 --- a/src/main/java/widoco/LODEParser.java +++ b/src/main/java/widoco/LODEParser.java @@ -21,8 +21,6 @@ import java.net.URLDecoder; import java.util.HashMap; import java.util.Properties; -//import java.util.logging.Level; -//import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -225,13 +223,9 @@ private void parse(String content, Properties langFile) { } catch (DOMException ex) { logger.error("Exception interpreting the resource: " + ex.getMessage()); } catch (SAXException ex) { - // moving to SLF4J logger.error(MarkerFactory.getMarker("FATAL"), ex.getMessage()); - // Logger.getLogger(LODEParser.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { - // moving to SLF4J logger.error(MarkerFactory.getMarker("FATAL"), ex.getMessage()); - // Logger.getLogger(LODEParser.class.getName()).log(Level.SEVERE, null, ex); } } diff --git a/src/main/java/widoco/WidocoUtils.java b/src/main/java/widoco/WidocoUtils.java index d271063..1053376 100644 --- a/src/main/java/widoco/WidocoUtils.java +++ b/src/main/java/widoco/WidocoUtils.java @@ -30,7 +30,8 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.io.FileDocumentSource; import org.semanticweb.owlapi.model.*; @@ -42,13 +43,12 @@ */ public class WidocoUtils { - final static Logger logger = Logger.getLogger(WidocoUtils.class); + private static final Logger logger = LoggerFactory.getLogger(WidocoUtils.class); /** * Method that will download the ontology to document with Widoco. * - * @param c - * Widoco configuration object. + * @param c Widoco configuration object. * @throws java.lang.Exception */ public static void loadModelToDocument(Configuration c) throws Exception { @@ -58,17 +58,12 @@ public static void loadModelToDocument(Configuration c) throws Exception { c.setFromFile(true); c.setOntologyPath(newOntologyPath); } - // reding the model with Jena (deprecated) - // OntModel model = - // ModelFactory.createOntologyModel();//ModelFactory.createDefaultModel(); - // readOntModel(model, c); - // c.getMainOntology().setMainModel(model); logger.info("Load ontology " + c.getOntologyPath()); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); - OWLOntologyIRIMapper jenaCatalogMapper = new JenaCatalogIRIMapper(); + OWLOntologyIRIMapper jenaCatalogMapper = new CatalogIRIMapper(); manager.getIRIMappers().add(jenaCatalogMapper); - ((JenaCatalogIRIMapper) jenaCatalogMapper).printMap(); + ((CatalogIRIMapper) jenaCatalogMapper).printMap(); OWLOntologyLoaderConfiguration loadingConfig = new OWLOntologyLoaderConfiguration(); loadingConfig = loadingConfig.setMissingImportHandlingStrategy(MissingImportHandlingStrategy.SILENT); OWLOntology ontology = manager diff --git a/src/main/java/widoco/entities/Ontology.java b/src/main/java/widoco/entities/Ontology.java index 6dfe2b9..50651bb 100644 --- a/src/main/java/widoco/entities/Ontology.java +++ b/src/main/java/widoco/entities/Ontology.java @@ -121,6 +121,11 @@ public class Ontology { * Compatible with */ private String backwardsCompatibleWith; + + /** + * owl:incompatibleWith + */ + private String incompatibleWith; public Ontology() { } @@ -291,26 +296,7 @@ public void setStatus(String status) { this.status = status; } - /** - * - * THESE TWO METHODS BELOW SHOULD BE REMOVED - */ - -// public OntModel getMainModel() { -// return mainOntologyModel; -// } -// -// public void setMainModel(OntModel model) { -// this.mainOntologyModel = model; -// } - - /** - * - * THESE TWO METHODS ABOVE SHOULD BE REMOVED - */ - - //Should have getManager and getOWLOntology. - //In the ontology creation, should load the imports only when generating the doc (if necessary). + /** * Getter for the in-memory ontology representation. * @return @@ -346,6 +332,12 @@ public String getBackwardsCompatibleWith() { public void setBackwardsCompatibleWith(String backwardsCompatibleWith) { this.backwardsCompatibleWith = backwardsCompatibleWith; } - - + + public String getIncompatibleWith() { + return incompatibleWith; + } + + public void setIncompatibleWith(String incompatibleWith) { + this.incompatibleWith = incompatibleWith; + } } diff --git a/src/main/java/widoco/gui/GuiController.java b/src/main/java/widoco/gui/GuiController.java index 71c2e16..770e1c6 100644 --- a/src/main/java/widoco/gui/GuiController.java +++ b/src/main/java/widoco/gui/GuiController.java @@ -25,10 +25,10 @@ import javax.swing.JOptionPane; import javax.swing.UIManager; import org.apache.commons.io.FileUtils; -import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import widoco.Configuration; +import widoco.Constants; import widoco.CreateDocInThread; import widoco.CreateOOPSEvalInThread; import widoco.CreateResources; @@ -41,7 +41,7 @@ */ public final class GuiController { - final static Logger logger = Logger.getLogger(GuiController.class); + private static final Logger logger = LoggerFactory.getLogger(GuiController.class); public enum State { initial, metadata, loadingConfig, sections, loading, generated, evaluating, exit @@ -56,15 +56,9 @@ public GuiController() { config = new Configuration(); System.out.println("\n\n--WIzard for DOCumenting Ontologies (WIDOCO).\n https://w3id.org/widoco/\n"); System.out.println("\nYou are launching WIDOCO GUI\n"); - System.out.println("\nTo use WIDOCO through the command line please do:\n"); - System.out.println( - "java -jar widoco.jar [-ontFile file] or [-ontURI uri] [-outFolder folderName] [-confFile propertiesFile] [-getOntologyMetadata] [-oops] " - + "[-rewriteAll] [-crossRef] [-saveConfig configOutFile] [-lang lang1-lang2] [-includeImportedOntologies] [-htaccess] [-licensius] [-webVowl] " - + "[-ignoreIndividuals] [-includeAnnotationProperties] [-analytics analyticsCode] [-doNotDisplaySerializations] [-displayDirectImportsOnly]" - + "[-rewriteBase rewriteBasePath] [-excludeIntroduction] [-uniteSections]. \nSee more information in https://github.com/dgarijo/Widoco/#how-to-use-widoco\n"); - //configure logger. - Logger.getRootLogger().setLevel(Level.INFO); - BasicConfigurator.configure(); + System.out.println("\nTo use WIDOCO through the command line please type:\n"); + System.out.println(Constants.HELP_TEXT); + // read logo try { gui = new GuiStep1(this); @@ -174,14 +168,13 @@ public GuiController(String[] args) { break; case "-uniteSections": uniteSections = true; - break; + break; + case "--help": + System.out.println(Constants.HELP_TEXT); + return; default: System.out.println("Command" + s + " not recognized."); - System.out.println( - "Usage: java -jar widoco.jar [-ontFile file] or [-ontURI uri] [-outFolder folderName] [-confFile propertiesFile] [-getOntologyMetadata] [-oops] " - + "[-rewriteAll] [-crossRef] [-saveConfig configOutFile] [-lang lang1-lang2] [-includeImportedOntologies] [-htaccess] [-licensius] [-webVowl] " - + "[-ignoreIndividuals] [-includeAnnotationProperties] [-analytics analyticsCode] [-doNotDisplaySerializations] [-displayDirectImportsOnly]" - + "[-rewriteBase rewriteBasePath] [-excludeIntroduction] [-uniteSections]\n"); + System.out.println(Constants.HELP_TEXT); return; } i++; diff --git a/src/main/java/widoco/gui/GuiStep1.java b/src/main/java/widoco/gui/GuiStep1.java index dc607f1..459a3bf 100644 --- a/src/main/java/widoco/gui/GuiStep1.java +++ b/src/main/java/widoco/gui/GuiStep1.java @@ -33,13 +33,16 @@ import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * * @author Daniel Garijo */ public class GuiStep1 extends javax.swing.JFrame { - + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); private GuiController g;// pointer to be able to save and go to the next state. private String folderPath; @@ -461,12 +464,12 @@ public String getDescription() { // chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { - System.out.println("You chose to save this file: " + chooser.getSelectedFile().getName()); + logger.info("You chose to save this file: " + chooser.getSelectedFile().getName()); this.textFieldPath.setText(chooser.getSelectedFile().getAbsolutePath()); } } - }// GEN-LAST:event_option1ItemStateChanged + } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton browseButton; diff --git a/src/main/java/widoco/gui/GuiStep2.java b/src/main/java/widoco/gui/GuiStep2.java index 781ad64..0e9d3a2 100644 --- a/src/main/java/widoco/gui/GuiStep2.java +++ b/src/main/java/widoco/gui/GuiStep2.java @@ -209,14 +209,15 @@ private void refreshTable() { { "ontology ns URI", conf.getMainOntology().getNamespaceURI() }, { "date of release", conf.getMainOntology().getReleaseDate() }, { "this version URI", conf.getMainOntology().getThisVersion() }, - { "latest version URI", conf.getMainOntology().getLatestVersion() }, + { "latest version URI", conf.getMainOntology().getNamespaceURI() }, { "previous version URI", conf.getMainOntology().getPreviousVersion() }, { "ontology revision", conf.getMainOntology().getRevision() }, { "authors", authors }, { "contributors", contributors }, { "publisher", publisher }, { "imported ontologies", imported }, { "extended ontologies", extended }, { "license", conf.getMainOntology().getLicense().getUrl() }, { "cite as", conf.getMainOntology().getCiteAs() }, { "doi", conf.getMainOntology().getDoi() }, { "status", conf.getMainOntology().getStatus() }, - { "backwards compatible with", conf.getMainOntology().getBackwardsCompatibleWith() } }, + { "backwards compatible with", conf.getMainOntology().getBackwardsCompatibleWith() }, + { "incompatible with", conf.getMainOntology().getIncompatibleWith()} }, new String[] { "Property", "Value" }) { Class[] types = new Class[] { java.lang.String.class, java.lang.Object.class }; boolean[] canEdit = new boolean[] { false, true }; @@ -284,6 +285,8 @@ private void saveMetadata() { conf.getMainOntology().setStatus(value); } else if (prop.equals("backwards compatible with")) { conf.getMainOntology().setBackwardsCompatibleWith(value); + } else if (prop.equals("incompatible with")) { + conf.getMainOntology().setIncompatibleWith(value); } // } } diff --git a/src/main/resources/widoco/cs.properties b/src/main/resources/widoco/cs.properties index 97d6cad..7896824 100644 --- a/src/main/resources/widoco/cs.properties +++ b/src/main/resources/widoco/cs.properties @@ -1,77 +1,78 @@ thisVersion=Tato verze: -latestVersion=Posledn\u00ED verze: -previousVersion=P\u0159edchoz\u00ED verze: +latestVersion=Posledn\u00ed verze: +previousVersion=P\u0159edchoz\u00ed verze: revision=Revize: -date=Vyd\u00E1n\u00ED +date=Vyd\u00e1n\u00ed authors=Auto\u0159i: -contributors=P\u0159isp\u011Bvatel\u00E9: -extended=Extendovan\u00E9 ontologie: -imported=Importovan\u00E9 ontologie: +contributors=P\u0159isp\u011bvatel\u00e9: +extended=Extendovan\u00e9 ontologie: +imported=Importovan\u00e9 ontologie: abstract=Abstrakt -abstractPlaceHolder=Toto je m\u00EDsto, na kter\u00E9 pat\u0159\u00ED abstrakt. Abstrakt by m\u011Bl obsahovat n\u011Bkolik v\u011Bt shrnuj\u00EDc\u00EDch obsah ontologie a jej\u00ED \u00FA\u010Del. +abstractPlaceHolder=Toto je m\u00edsto, na kter\u00e9 pat\u0159\u00ed abstrakt. Abstrakt by m\u011bl obsahovat n\u011bkolik v\u011bt shrnuj\u00edc\u00edch obsah ontologie a jej\u00ed \u00fa\u010del. license=Licence: -licenseIfNull=Zde dopl\u0148te n\u00E1zev licence +licenseIfNull=Zde dopl\u0148te n\u00e1zev licence licenseURLIfNull=http://vlozUriLicenceZde.org toc=Obsah -ns=Deklarace jmenn\u00FDch prostor\u016F -nsText=\n
\n\n\n\n -introTitle=\u00DAvod -introPlaceHolder=\u00DAvod zp\u011Bt k obsahu\n\nToto je m\u00EDsto pro \u00DAvod. \u00DAvod by m\u011Bl kr\u00E1tce popsat obsah ontologie, jej\u00ED motivaci, aktu\u00E1ln\u00ED stav a c\u00EDle\n -namespace=Deklarace jmenn\u00FDch prostor\u016F +ns=Deklarace jmenn\u00fdch prostor\u016f +nsText=\n
\n
Table 1: Jmenn\u00E9 prostory pou\u017Eit\u00E9 v tomto dokumentut
\n\n\n +introTitle=\u00davod +introPlaceHolder=\u00davod zp\u011bt k obsahu\n\nToto je m\u00edsto pro \u00davod. \u00davod by m\u011bl kr\u00e1tce popsat obsah ontologie, jej\u00ed motivaci, aktu\u00e1ln\u00ed stav a c\u00edle\n +namespace=Deklarace jmenn\u00fdch prostor\u016f overviewTitle=P\u0159ehled -overviewPlaceHolder=P\u0159ehled zp\u011Bt k ToC\n\nTato ontologie m\u00E1 n\u00E1sleduj\u00EDc\u00ED t\u0159\u00EDdy a vlastnosti.\n +overviewPlaceHolder=P\u0159ehled zp\u011bt k ToC\n\nTato ontologie m\u00e1 n\u00e1sleduj\u00edc\u00ed t\u0159\u00eddy a vlastnosti.\n descriptionTitle=Popis -descriptionPlaceHolder=Popis zp\u011Bt k obsahu\n\nToto je m\u00EDsto pro popis ontologie. Popis m\u00E1 obsahovat vysv\u011Btlen\u00ED a diagram ukazuj\u00EDc\u00ED vztahy mezi t\u0159\u00EDdami, p\u0159\u00EDklady pou\u017Eit\u00ED, atd.\n -crossRefTitle=K\u0159\u00ED\u017Eov\u00FD odkaz pro -crossRefTitle2=t\u0159\u00EDdy, objektov\u00E9 vlastnosti a datov\u00E9 vlastnosti zp\u011Bt k obsahu -crossRefPlaceHolder=Tato sekce poskytuje detaily pro ka\u017Edou t\u0159\u00EDdu a vlastnost definovanou -classes=T\u0159\u00EDdy -objProp=Objektov\u00E9 vlastnosti -dataProp=Datov\u00E9 vlastnosti -annProp=Anota\u010Dn\u00ED vlastnosti -namedIndiv=Pojmenovan\u00E9 individu\u00E1ly +descriptionPlaceHolder=Popis zp\u011bt k obsahu\n\nToto je m\u00edsto pro popis ontologie. Popis m\u00e1 obsahovat vysv\u011btlen\u00ed a diagram ukazuj\u00edc\u00ed vztahy mezi t\u0159\u00eddami, p\u0159\u00edklady pou\u017eit\u00ed, atd.\n +crossRefTitle=K\u0159\u00ed\u017eov\u00fd odkaz pro +crossRefTitle2=t\u0159\u00eddy, objektov\u00e9 vlastnosti a datov\u00e9 vlastnosti zp\u011bt k obsahu +crossRefPlaceHolder=Tato sekce poskytuje detaily pro ka\u017edou t\u0159\u00eddu a vlastnost definovanou +classes=T\u0159\u00eddy +objProp=Objektov\u00e9 vlastnosti +dataProp=Datov\u00e9 vlastnosti +annProp=Anota\u010dn\u00ed vlastnosti +namedIndiv=Pojmenovan\u00e9 individu\u00e1ly referencesTitle=Odkazy -referencesPlaceHolder=Odkazy zp\u011Bt k obsahu\n\nP\u0159idej sem odkazy. Doporu\u010Duje se je zobrazit jako seznam.\n -ackTitle=Pod\u011Bkov\u00E1n\u00ED -ackText=Pod\u011Bkov\u00E1n\u00ED (en) zp\u011Bt k obsahu\n

\nThe authors would like to thank Silvio Peroni for developing LODE, a Live OWL Documentation Environment, which is used for representing the Cross Referencing Section of this document and Daniel Garijo for developing Widoco, the program used to create the template used in this documentation.

\n\n +referencesPlaceHolder=Odkazy zp\u011bt k obsahu\n\nP\u0159idej sem odkazy. Doporu\u010duje se je zobrazit jako seznam.\n +ackTitle=Pod\u011bkov\u00e1n\u00ed +ackText=Pod\u011bkov\u00e1n\u00ed (en) zp\u011bt k obsahu\n

\nThe authors would like to thank Silvio Peroni for developing LODE, a Live OWL Documentation Environment, which is used for representing the Cross Referencing Section of this document and Daniel Garijo for developing Widoco, the program used to create the template used in this documentation.

\n\n prov1=Provenance pro prov2=Dokumentace -createdBy=Tv\u016Frce ontologie: -contribBy=Spolutv\u016Frce ontologie: -spec=je specializac\u00ED obecn\u00E9ho IRI -rev=je reviz\u00ED p\u0159edchoz\u00ED verze -result=Dokumentace ontologie byla v\u00FDsledkem pou\u017Eit\u00ED n\u00E1stroje Widoco (kter\u00FD vyu\u017E\u00EDv\u00E1 LODE pro generov\u00E1n\u00ED k\u0159\u00ED\u017Eov\u00FDch odkaz\u016F).\n -generated=Dokumentace byla generov\u00E1na v -changeLog=

Zm\u011Bny od posledn\u00EDho vyd\u00E1n\u00ED zp\u011Bt k obsahu

Toto je p\u0159ehled zm\u011Bn. Tato sekce je voliteln\u00E1, ale doporu\u010Den\u00E1

+createdBy=Tv\u016frce ontologie: +contribBy=Spolutv\u016frce ontologie: +spec=je specializac\u00ed obecn\u00e9ho IRI +rev=je reviz\u00ed p\u0159edchoz\u00ed verze +result=Dokumentace ontologie byla v\u00fdsledkem pou\u017eit\u00ed n\u00e1stroje Widoco (kter\u00fd vyu\u017e\u00edv\u00e1 LODE pro generov\u00e1n\u00ed k\u0159\u00ed\u017eov\u00fdch odkaz\u016f).\n +generated=Dokumentace byla generov\u00e1na v +changeLog=

Zm\u011bny od posledn\u00edho vyd\u00e1n\u00ed zp\u011bt k obsahu

Toto je p\u0159ehled zm\u011bn. Tato sekce je voliteln\u00e1, ale doporu\u010den\u00e1

citeAs=Citujte jako: -back=zp\u011Bt k +back=zp\u011bt k back1=documentace -back2=form\u00E1t TTL -back3=zp\u011Bt k obsahu -provHead=Provenance t\u00E9to str\u00E1nky -serialization=Serializace sta\u017Een\u00ED: +back2=form\u00e1t TTL +back3=zp\u011bt k obsahu +provHead=Provenance t\u00e9to str\u00e1nky +serialization=Serializace sta\u017een\u00ed: 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=Vizualizace: -publisher=Publik\u00E1tor: -changelogHead=Zm\u011Bny od posledn\u00ED verze -addedClass=P\u0159idan\u00E9 t\u0159\u00EDdy -modifiedClass=Zm\u011Bnen\u00E9 t\u0159\u00EDdy -deletedClass=Smazan\u00E9 t\u0159\u00EDdy -addedProp=P\u0159idan\u00E9 vlastnosti -modifiedProp=Zm\u011Bn\u011Bn\u00E9 vlastnosti -deletedProp=Smazan\u00E9 vlastnosti -modifiedDataProp=Zm\u011Bn\u011Bn\u00E9 datov\u00E9 vlastnosti -addedDataProp=P\u0159idan\u00E9 datov\u00E9 vlastnosti -deletedDataProp=Smazan\u00E9 datov\u00E9 vlastnosti -added=P\u0159idan\u00E9 -deleted=Smazan\u00E9 -subClassOf=podt\u0159\u00EDdou -subPropOf=podvlastnost\u00ED -domain=Dom\u00E9na +publisher=Publik\u00e1tor: +changelogHead=Zm\u011bny od posledn\u00ed verze +addedClass=P\u0159idan\u00e9 t\u0159\u00eddy +modifiedClass=Zm\u011bnen\u00e9 t\u0159\u00eddy +deletedClass=Smazan\u00e9 t\u0159\u00eddy +addedProp=P\u0159idan\u00e9 vlastnosti +modifiedProp=Zm\u011bn\u011bn\u00e9 vlastnosti +deletedProp=Smazan\u00e9 vlastnosti +modifiedDataProp=Zm\u011bn\u011bn\u00e9 datov\u00e9 vlastnosti +addedDataProp=P\u0159idan\u00e9 datov\u00e9 vlastnosti +deletedDataProp=Smazan\u00e9 datov\u00e9 vlastnosti +added=P\u0159idan\u00e9 +deleted=Smazan\u00e9 +subClassOf=podt\u0159\u00eddou +subPropOf=podvlastnost\u00ed +domain=Dom\u00e9na range=Obor hodnot -unionOf=Sjednocen\u00ED -intersectionOf=Pr\u016Fnik +unionOf=Sjednocen\u00ed +intersectionOf=Pr\u016fnik tableOfContents=Obsah -compatible=Kompatibiln\u00ED s +compatible=Kompatibiln\u00ed s +incompatible=Nekompatibiln\u00ed s legend=Legenda diff --git a/src/main/resources/widoco/en.properties b/src/main/resources/widoco/en.properties index 897a8f3..b42113d 100644 --- a/src/main/resources/widoco/en.properties +++ b/src/main/resources/widoco/en.properties @@ -74,4 +74,5 @@ unionOf=Union of intersectionOf=Intersection of tableOfContents=Table of contents compatible=Compatible with +incompatible=Incompatible with legend=Legend \ No newline at end of file diff --git a/src/main/resources/widoco/es.properties b/src/main/resources/widoco/es.properties index 11cfb7d..bca0157 100644 --- a/src/main/resources/widoco/es.properties +++ b/src/main/resources/widoco/es.properties @@ -74,4 +74,5 @@ unionOf=Union de intersectionOf=Intersección de tableOfContents=Tabla de contenidos compatible=Compatible con +incompatible=Incompatible con legend=Leyenda \ No newline at end of file diff --git a/src/main/resources/widoco/fr.properties b/src/main/resources/widoco/fr.properties index 573d3ce..cb2ae66 100644 --- a/src/main/resources/widoco/fr.properties +++ b/src/main/resources/widoco/fr.properties @@ -42,7 +42,7 @@ contribBy=Contributeurs: spec=est une spécialisation de l'URI générique rev=est une révision de la version précédente result=La documentation de l'ontologie résulte de l'utilisation de Widoco tool (qui utilise LODE pour générer les sections de référencement croisé).\n -generated=Cette documentation a été générée le (à) +generated=Cette documentation a été générée le (\u00c3\u00a0) changeLog=

Changements depuis la derniè re publication retour au sommaire

Ceci est le journal de changements. Cette section est optionnelle, mais recommandée

citeAs=Citer en tant que: back=Retour @@ -74,4 +74,5 @@ unionOf=Union de intersectionOf=Intersection de tableOfContents=Sommaire compatible=Compatible avec +incompatible=Incompatible avec legend=Légende diff --git a/src/main/resources/widoco/pt.properties b/src/main/resources/widoco/pt.properties index 733a62f..1465b93 100644 --- a/src/main/resources/widoco/pt.properties +++ b/src/main/resources/widoco/pt.properties @@ -30,7 +30,7 @@ classes=Classes objProp=Propriedades do objeto dataProp=Propriedades de dados annProp=Propriedades de anotação -namedIndiv=Os indivíduos nomeados +namedIndiv=Os indiv\u00c3\u00adduos nomeados referencesTitle=Referências referencesPlaceHolder=Referências de volta a índice\nAdicione suas referências aqui. Recomenda-se a tê-los como uma lista.\n ackTitle=Agradecimentos @@ -43,7 +43,7 @@ spec=é uma especialização da URI genérico rev=é uma revisão da versão anterior result=A documentação ontologia foi o resultado do uso da ferramenta Widoco (que se utiliza LODE para gerar a secção em termos de ontologia).\n generated=A documentação foi gerado pelo -changeLog="
"

Alterações desde a última versão de volta a índice

Este é um log de alterações. Esta seção é opcional, mas recomendado

+changeLog="
"

Alterações desde a \u00c3\u00baltima versão de volta a índice

Este é um log de alterações. Esta seção é opcional, mas recomendado

citeAs=Cite como: back=de volta a back1=documentação @@ -74,4 +74,5 @@ unionOf=Union de intersectionOf=Intersección de tableOfContents=Tabela de conteúdos compatible=compatível com +incompatible=Incompatível com legend=lenda \ No newline at end of file diff --git a/src/test/java/oops/OOPSevaluationTest.java b/src/test/java/oops/OOPSevaluationTest.java index c6a18ad..b8edc76 100644 --- a/src/test/java/oops/OOPSevaluationTest.java +++ b/src/test/java/oops/OOPSevaluationTest.java @@ -26,7 +26,7 @@ public OOPSevaluationTest() { @Test public void testPrintEvaluation() { try{ - System.out.println("printEvaluation"); + System.out.println("printEvaluation with alo"); String content = null; BufferedReader br = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("/alo.owl"))); try { @@ -44,11 +44,39 @@ public void testPrintEvaluation() { } // The ontology has 6 pitfalls OOPSevaluation instance = new OOPSevaluation(content); - //instance.printEvaluation(); + instance.printEvaluation(); assertEquals(6, instance.getPitfallNumber()); }catch(IOException e){ fail("Error in test "+e.getMessage()); } } + @Test + public void testPrintEvaluation2() { + try{ + System.out.println("printEvaluation with p-plan"); + String content = null; + BufferedReader br = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("/p-plan.owl"))); + try { + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + + while (line != null) { + sb.append(line); + sb.append(System.lineSeparator()); + line = br.readLine(); + } + content = sb.toString(); + } finally { + br.close(); + } + // The ontology has 6 pitfalls + OOPSevaluation instance = new OOPSevaluation(content); + instance.printEvaluation(); + assertEquals(3, instance.getPitfallNumber()); + }catch(IOException e){ + fail("Error in test "+e.getMessage()); + } + } + } diff --git a/src/test/java/widoco/TestJenaCatalogIRIMapper.java b/src/test/java/widoco/TestJenaCatalogIRIMapper.java index a1299c4..222b93f 100644 --- a/src/test/java/widoco/TestJenaCatalogIRIMapper.java +++ b/src/test/java/widoco/TestJenaCatalogIRIMapper.java @@ -1,6 +1,7 @@ package widoco; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.semanticweb.owlapi.model.IRI; import static org.junit.Assert.*; @@ -10,9 +11,9 @@ */ public class TestJenaCatalogIRIMapper { - final static Logger logger = Logger.getLogger(TestJenaCatalogIRIMapper.class); + final static Logger logger = LoggerFactory.getLogger(TestJenaCatalogIRIMapper.class); - final static JenaCatalogIRIMapper iriMapper = new JenaCatalogIRIMapper() ; + final static CatalogIRIMapper iriMapper = new CatalogIRIMapper() ; @org.junit.Test public void testIsOntPolicyFileLoaded() { diff --git a/src/test/resources/p-plan.owl b/src/test/resources/p-plan.owl new file mode 100644 index 0000000..471d412 --- /dev/null +++ b/src/test/resources/p-plan.owl @@ -0,0 +1,425 @@ + + + + + + + + + + +]> + + + + + 2012-11-10 + 2014-03-12 + http://delicias.dia.fi.upm.es/members/DGarijo#me + http://www.isi.edu/~gil/ + 1.3 + PROV extension for linking Plans and parts of plans to their respective executions. Created by Daniel Garijo and Yolanda Gil + The P-Plan ontology + http://purl.org/net/p-plan# + PROV extension for linking Plans and parts of plans to their respective executions. + p-plan + http://creativecommons.org/licenses/by-nc-sa/2.0/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + correspondsToStep + p-plan:correspondsToStep links a p-plan:Activity to its planned p-plan:Step + + + + + + + + + + + + correspondsToVariable + p-plan:correspondsToVariable binds a p-plan:Entity (used by a p-plan:Activity in the execution of a plan) to the p-plan:Variable it represented it in the p-plan:Plan. + + + + + + + + + + + hasInputVar + p-plan:hasInputVar binds a p-plan:Step to the p-plan:Variable that takes as input for the planned execution + + + + + + + + + + + hasOutputVar + p-plan:hasOutputVar binds a p-plan:Step to the p-plan:Variable that will be produced as output in the planned execution + + + + + + + + + + + + isDecomposedAsPlan + The p-plan:isDecomposedAsPlan relationship binds a p-plan:MultiStep to the p-plan:Plan holding the definition of that step. That is, p-plan:isDecomposedAsPlan links the MultiStep to the Plan sptecification where it is decomposed. + + + + + + + + + + + isInputVarOf + p-plan:isInputVarOf links an input variable of a step to the step. + + + + + + + + + + + + + isOutputVarOf + p-plan:isOutputVarOf is intended to link an output variable of a step to the step. + + + + + + + + + + + + isPrecededBy + Property that asserts which Step preceeds the current one. + + + + + + + + + + + isStepOfPlan + p-plan:isStepOfPlan links a p-plan:Step to the p-plan:Plan which it corresponds to. + + + + + + + + + + + isSubPlanOfPlan + A p-plan:Plan may be a subplan of another bigger p-plan:Plan. p-plan:isSubPlanOfPlan is used to state the link among the two different plans. Note that if p1 is a p-plan:subPlan of p2, p1will not necessarily be a step of p2. A multistep will represent p1 in p2, and link to p1 with the p-plan.hasStepDecomposition relationship. + + + + + + + + + + + + isVariableofPlan + p-plan:IsVariableOfPlan binds a p-plan:Variable to the p-plan:Plan it corresponds to. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Activity + + A p-plan:Activity represents the execution process planned in a p-plan:Step + + + + + + + + + Bundle + + + A p-plan:Bundle is a specific type of prov:Bundle that contains the provenance assertions of the execution of a p-plan:Plan + + + + + + + + + Entity + + A p-plan:Entity represents the input of the execution of a p-plan:Activity. It corresponds to a p-plan:Variable. + + + + + + + + + MultiStep + + + A multi step is the representation of a plan that appears as a step of another plan. + + + + + + + + + Plan + + + A p-plan:Plan is a specific type of prov:Plan. It is composed of smaller steps that use and produce Variables. + + + + + + + + + Step + A p-plan:Step represents the planned execution activity + + + + + + + + + Variable + A p-plan:Variable represents a description of the input of the planned Activity (p-plan:Step) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 1: Jmenn\u00e9 prostory pou\u017eit\u00e9 v tomto dokumentut