diff --git a/doc/bestPractices/sections/checklist-en.html b/doc/bestPractices/sections/checklist-en.html index e7cbef1..2bed613 100644 --- a/doc/bestPractices/sections/checklist-en.html +++ b/doc/bestPractices/sections/checklist-en.html @@ -124,8 +124,9 @@

Status [OPTION -Note that the range of bibo:status is a "bibo:DocumentStatus" instance. Common status include: bibo:status/accepted, bibo:status/draft, bibo:status/published, bibo:status/rejected and bibo:status/peerReviewed. For more information, please see the bibo vocabulary. In MOD, the status is a string. +Note that the range of bibo:status is a "bibo:DocumentStatus" instance. Common status include: bibo:status/accepted, bibo:status/draft, bibo:status/published, bibo:status/rejected and bibo:status/peerReviewed. For more information, please see the bibo vocabulary. In MOD, status is a string. In schema.org, status may refer to a string or to a schema:DefinedTerm.
Example:
@@ -433,6 +434,45 @@ 
Example:
dct:publisher <http://www.oeg-upm.net/; .
+

Funder [OPTIONAL]

+

+Organizations (or persons) responsible for funding the vocabulary. Ontologies are often a product of funding organizations, and hence they should be acknowledged. +

+ + + +
Example:
+
+@prefix owl: <http://www.w3.org/2002/07/owl#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+<https://w3id.org/fr/def/core#> a owl:Ontology ;
+    foaf:funder <https://example.org/fundingOrganization> .
+
+ +

Funding [OPTIONAL]

+

+Projects or grants responsible for funding the vocabulary. Note that the range of this property is a schema:Grant. +

+ + + +
Example:
+
+@prefix owl: <http://www.w3.org/2002/07/owl#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix schema: <https://schema.org/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+<https://w3id.org/fr/def/core#> a owl:Ontology ;
+    foaf:funding <https://example.org/fundingGrant> .
+
+

Vocabulary citation

Ontologies are considered software, and should be cited as such [Smith et al 2016]. However, researchers reusing the ontology may not refer to the correct citation associated to it. Adding metadata to help them would address this issue, granting you the appropriate credit for your work.

diff --git a/doc/bestPractices/sections/introduction-en.html b/doc/bestPractices/sections/introduction-en.html index 17b646a..9356599 100644 --- a/doc/bestPractices/sections/introduction-en.html +++ b/doc/bestPractices/sections/introduction-en.html @@ -53,51 +53,53 @@

Properties summary

Summary of RECOMMENDED properties for vocabularies Summary of OPTIONAL properties for vocabularies Summary of RECOMMENDED properties for classes and properties Summary of OPTIONAL properties for classes and properties diff --git a/doc/configuration/config.properties b/doc/configuration/config.properties index 07acd41..a152abc 100644 --- a/doc/configuration/config.properties +++ b/doc/configuration/config.properties @@ -15,8 +15,8 @@ contributorsInstitutionURI=https://isi.edu/;https://isi.edu/ description="A description of what the ontology does goes here" diagram="https://example.org/diagram.svg" DOI= -funder= -fundingGrant= +funders= +fundingGrants= incompatibleWith= issued= images=image1.png;image2.png @@ -45,4 +45,4 @@ extendedOntologyNames=test1; test2 extendedOntologyURIs=http://example.org/test1; http://example.org/test2 RDFXMLSerialization=ontology.xml TurtleSerialization=ontology.ttl -N3Serialization=ontology.nt +NTSerialization=ontology.nt diff --git a/doc/configuration/configuration_doc.md b/doc/configuration/configuration_doc.md index 1234ae9..86fb03d 100644 --- a/doc/configuration/configuration_doc.md +++ b/doc/configuration/configuration_doc.md @@ -21,21 +21,26 @@ contributorsInstitutionURI=https://isi.edu/;https://isi.edu/ description="A description of what the ontology does goes here" diagram="https://example.org/diagram.svg" DOI= -incompatibleWith="" -issued="" +funder= +fundingGrant= +incompatibleWith= +issued= +images=image1.png;image2.png licenseURI=http://creativecommons.org/licenses/by/2.0/ licenseName=CC-BY licenseIconURL=https://i.creativecommons.org/l/by/2.0/88x31.png logo="https://example.org/logo.svg" -ontologyName=The Cohort Ontology +ontologyName=Example ontologyPrefix=exo modified="15 April, 2023" ontologyNamespaceURI=https://w3id.org/example previousVersionURI=https://w3id.org/example/1.0.0 -publisher= -publisherURI= -publisherInstitution= -publisherInstitutionURI= +publisher=Ontology Engineering Group +publisherURI=https://oeg-upm.es +publisherInstitution=UPM +publisherInstitutionURI=https://www.upm.es +source=http://source1;http://source2 +seeAlso=http://firstResource ontologyTitle=The Example Ontology thisVersionURI=https://w3id.org/example/1.0.1 ontologyRevisionNumber=v1.0.0 @@ -50,7 +55,7 @@ extendedOntologyNames=test1; test2 extendedOntologyURIs=http://example.org/test1; http://example.org/test2 RDFXMLSerialization=URL of the file with RDF-XML serialization. E.g., http://my-onto/onto.owl TurtleSerialization=URL of the file with Turtle serialization. E.g., http://my-onto/onto..ttl; -N3Serialization=URL of the file with N3 serialization. E.g., http://my-onto/onto.n3 +NTSerialization=URL of the file with N3 serialization. E.g., http://my-onto/onto.n3 JSONLDSerialization=URL of the file with JSON-LD serialization. E.g., http://my-onto/onto.jsonld GoogleAnalyticsCode=UA-TestCodeGoesHere contextURI=JSON-LD context URI. diff --git a/doc/metadataGuide/guide.md b/doc/metadataGuide/guide.md index 957b115..e3a2099 100644 --- a/doc/metadataGuide/guide.md +++ b/doc/metadataGuide/guide.md @@ -30,6 +30,7 @@ In this document we illustrate how Widoco uses metadata in the final documentati |vann |[http://purl.org/vocab/vann/](http://purl.org/vocab/vann/) | |vcard |[http://www.w3.org/2006/vcard/ns#](http://www.w3.org/2006/vcard/ns#) | |wdrs |[http://www.w3.org/2007/05/powder-s#](http://www.w3.org/2007/05/powder-s#) | +|widoco |[https://w3id.org/widoco/vocab#](https://w3id.org/widoco/vocab#) | ## Metadata usage in WIDOCO @@ -51,6 +52,8 @@ The table below shows which ontology metadata annotations are recognized in WIDO |Diagram |[foaf:image], [foaf:depiction], [schema:image]|diagram |[Sec 3.8.2] **[OPTIONAL]**|[Text]|[ontology](#onto), [config]| |DOI |[bibo:doi] |DOI |[Sec 3.6.1] **[OPTIONAL]**|[Text]|[ontology](#onto), [config]| |Extended ontologies| [voaf:extends] |extendedOntologyNames, extendedOntologyURIs | [Sec 3.4.6] **[OPTIONAL]**|[URI]|[ontology](#onto), [config]| +|Funders (org, person) |[foaf:fundedBy] [schema:funder] |funders |[Sec 3.5.4] **[OPTIONAL]**|[Text] or [URI]|[ontology](#onto), [config]| +|Funding grants |[schema:funding] |fundingGrant |[Sec 3.5.5] **[OPTIONAL]**|[Text] or [URI]|[ontology](#onto), [config]| |Incompatible with|[owl:incompatibleWith] |incompatibleWith|[Sec 3.3.4] **[OPTIONAL]**|[URI] |[ontology](#onto), [config]| |Imported ontologies|[owl:imports] |importedOntologyNames, importedOntologyURIs|**[RECOMMENDED]** (good practice in ontology engineering) | [URI] | [ontology](#onto), [config]| |Issued date |[dct:issued], [schema:dateIssued]|issued |[Sec 3.4.4] **[OPTIONAL]**|[Text]|[ontology](#onto), [config]| @@ -63,7 +66,7 @@ The table below shows which ontology metadata annotations are recognized in WIDO |Previous version|[dce:replaces], [dct:replaces], [prov:wasRevisionOf], [pav:previousVersion], [owl:priorVersion]|previousVersionURI|[Sec 3.4.1] **[RECOMMENDED]**|[URI]|[ontology](#onto), [config]| |Publisher|[dct:publisher], [dce:publisher], [schema:publisher]|publisher, publisherURI, publisherInstitution, publisherInstitutionURI|[Sec 3.5.3] **[OPTIONAL]**|[Text] or [Organization] or [BNode]|[ontology](#onto), [config]| |Similar resources|[rdfs:seeAlso] | |[Sec 3.9] **[OPTIONAL]** |[Text] |[ontology](#onto), [config]| -|Status |[bibo:status] [mod:status] |status|[Sec 3.2.4] **[OPTIONAL]**|[Text] or [Status](#status)|[ontology](#onto), [config]| +|Status |[bibo:status] [mod:status] [schema:creativeWorkStatus] |status|[Sec 3.2.4] **[OPTIONAL]**|[Text] or [Status](#status)|[ontology](#onto), [config]| |Source|[dce:source], [dct:source], [prov:hadPrimarySource], [wdrs:describedBy]|source|[Sec 3.4.5] **[OPTIONAL]** |[URI] |[ontology](#onto), [config]| |Title |[dce:title], [dct:title], [schema:name] |ontologyTitle |[Sec 3.2.2] **[RECOMMENDED]**|[Text]|[ontology](#onto), [config]| |Version IRI |[owl:versionIRI] |thisVersionURI |[Sec 3.3.1] **[RECOMMENDED]**|[URI] |[ontology](#onto), [config]| @@ -73,6 +76,17 @@ The table below shows which ontology metadata annotations are recognized in WIDO **\*\*** Configuration properties do not support [URI](#uri)s or blank nodes. Hence, additional properties are needed (like authorsURI, contributorsURI) to annotate URIs in case they are needed. +### Custom annotations +We prioritize reusing metadata properties defined already. However, a small subset of `OPTIONAL` annotation properties (i.e., `introduction` and the URL to the different serializations) have been introduced by WIDOCO to customize parts of the documentation from the ontology itself: + +|Metadata category|Ontology annotation property*|`config.properties` field(s)**|Good practices document|Accepted property value|Example| +|-----------------|-----------------------------|------------------------------|-----------------------|-----------------------|-------| +|Introduction |[widoco:introduction] |introduction |N/A **[OPTIONAL]** |[Text]|[ontology](#onto), [config]| +|N-Triples serialization |[widoco:ntSerialization] |NTSerialization |N/A **[OPTIONAL]** |[URL] |[ontology](#onto), [config]| +|JSON-LD serialization |[widoco:jsonldSerialization] |JSONLDSerialization |N/A **[OPTIONAL]** |[URL] |[ontology](#onto), [config]| +|RDF-XML serialization |[widoco:rdfxmlSerialization] |RDFXMLSerialization |N/A **[OPTIONAL]** |[URL] |[ontology](#onto), [config]| +|Turtle serialization |[widoco:turtleSerialization] |TurtleSerialization |N/A **[OPTIONAL]** |[URL] |[ontology](#onto), [config]| + ### Term (classes, properties and data properties) annotations The table below summarizes all the metadata annotations recognized for ontology terms, in alphabetical order. Note that there are no `config.properties` annotations here, as these annotations are only read from the ontology file. @@ -103,7 +117,8 @@ The following `Turtle` code block shows sample annotations for each of the metad @prefix schema: . @prefix voaf: . @prefix vann: . -@prefix bibo: +@prefix widoco: . +@prefix bibo: . rdf:type owl:Ontology ; owl:versionIRI ; @@ -123,7 +138,12 @@ The following `Turtle` code block shows sample annotations for each of the metad voaf:extends ; owl:imports ; bibo:status ; + foaf:fundedBy ; + schema:funding ; + widoco:introduction "A paragraph with the introduction section of the documentation about your resource"@en ; + widoco:rdfxmlSerialization "https://example.org/serialization/ontology.xml"^^xsd:anyURI ; owl:versionInfo "1.0.1" . + #If content negotiation is enabled, the widoco:rdfxmlSerialization annotation may not be needed. ``` ### Annotating the ontology using entities: @@ -203,15 +223,18 @@ contributors=First contributor;Second contributor contributorsURI=http://example.org/contributor1;http://example.org/contributor2 contributorsInstitution=First contributor institution;Second contributor institution contributorsInstitutionURI=https://isi.edu/;https://isi.edu/ -description="A description of what the ontology does goes here" +description=A description of what the ontology does goes here diagram="https://example.org/diagram.svg" extendedOntologyNames=test1; test2 extendedOntologyURIs=http://example.org/test1; http://example.org/test2 DOI=https://dx.doi.org/SOME/DOI +funder=https://example.org/institution +funding=https://example.org/fundingGrant incompatibleWith=https://w3id.org/example/0.0.1 importedOntologyNames=Imported Ontology 1; Imported Ontology 2 importedOntologyURIs=http://example.org/test11; http://example.org/test22 -issued="" +introduction=A brief text for the introduction section may be written here. +issued= licenseURI=http://creativecommons.org/licenses/by/2.0/ licenseName=CC-BY licenseIconURL=https://i.creativecommons.org/l/by/2.0/88x31.png @@ -229,6 +252,10 @@ ontologyTitle=The Example Ontology thisVersionURI=https://w3id.org/example/1.0.1 ontologyRevisionNumber=v1.0.0 status=Ontology Specification Draft +RDFXMLSerialization=ontology.xml +TurtleSerialization=ontology.ttl +NTSerialization=ontology.nt +JSONLDSerialization=ontology.nt ``` ## Glossary (Back to table) @@ -274,6 +301,8 @@ status=Ontology Specification Draft [Sec 3.5.1]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#creators [Sec 3.5.2]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#contributors [Sec 3.5.3]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#publisher +[Sec 3.5.4]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#funder +[Sec 3.5.5]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#funding [Sec 3.6.1]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#doi [Sec 3.6.2]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#biblio [Sec 3.7]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#lic @@ -324,6 +353,7 @@ status=Ontology Specification Draft [doap:translator]: http://usefulinc.com/ns/doap#translator [foaf:depiction]: http://xmlns.com/foaf/0.1/depiction [foaf:family_name]: http://xmlns.com/foaf/0.1/family_name +[foaf:fundedBy]: http://xmlns.com/foaf/0.1/fundedBy [foaf:givenname]: http://xmlns.com/foaf/0.1/givenname [foaf:homepage]: http://xmlns.com/foaf/0.1/homepage [foaf:image]: http://xmlns.com/foaf/0.1/image @@ -362,6 +392,7 @@ status=Ontology Specification Draft [schema:citation]: https://schema.org/citation [schema:contributor]: https://schema.org/contributor [schema:creator]: https://schema.org/creator +[schema:creativeWorkStatus]: https://schema.org/creativeWorkStatus [schema:dateCreated]: https://schema.org/dateCreated [schema:dateIssued]: https://schema.org/dateIssued [schema:dateModified]: https://schema.org/dateModified @@ -377,6 +408,8 @@ status=Ontology Specification Draft [schema:publisher]: https://schema.org/publisher [schema:schemaVersion]: https://schema.org/schemaVersion [schema:url]: https://schema.org/url +[schema:funder]: https://schema.org/funder +[schema:funding]: https://schema.org/funding [skos:definition]: http://www.w3.org/2004/02/skos/core#definition [skos:editorialNote]: http://www.w3.org/2004/02/skos/core#editorialNote [skos:example]: http://www.w3.org/2004/02/skos/core#example @@ -394,3 +427,8 @@ status=Ontology Specification Draft [vcard:hasURL]: http://www.w3.org/2006/vcard/ns#hasURL [voaf:extends]: http://purl.org/vocommons/voaf#extends [wdrs:describedBy]: http://www.w3.org/2007/05/powder-s#describedBy +[widoco:introduction]: https://w3id.org/widoco/vocab#introduction +[widoco:rdfxmlSerialization]: https://w3id.org/widoco/vocab#rdfxmlSerialization +[widoco:turtleSerialization]: https://w3id.org/widoco/vocab#turtleSerialization +[widoco:ntSerialization]: https://w3id.org/widoco/vocab#ntSerialization +[widoco:jsonldSerialization]: https://w3id.org/widoco/vocab#jsonldSerialization diff --git a/src/main/java/widoco/Configuration.java b/src/main/java/widoco/Configuration.java index 044a43a..a11982b 100644 --- a/src/main/java/widoco/Configuration.java +++ b/src/main/java/widoco/Configuration.java @@ -120,6 +120,7 @@ public class Configuration { private String rewriteBase;// rewrite base path for content negotiation (.htaccess) private boolean includeAllSectionsInOneDocument; //boolean to indicate all sections should be included in a single big HTML private HashMap namespaceDeclarations; //Namespace declarations to be included in the documentation. + private String introText;// in case there is an explicit annotation in the ontology /** * Variable to keep track of possible errors in the changelog. If there are @@ -181,6 +182,7 @@ public final void initializeConfig() { rewriteBase = "/"; contextURI = ""; includeAllSectionsInOneDocument = false; + introText = ""; initializeOntology(); } @@ -223,6 +225,8 @@ private void initializeOntology() { mainOntologyMetadata.setImages(new ArrayList<>()); mainOntologyMetadata.setSources(new ArrayList<>()); mainOntologyMetadata.setSeeAlso(new ArrayList<>()); + mainOntologyMetadata.setFunders(new ArrayList<>()); + mainOntologyMetadata.setFundingGrants(new ArrayList<>()); this.namespaceDeclarations = new HashMap<>(); } @@ -385,6 +389,20 @@ private void loadPropertyFile(String path) throws IOException { if (!"".equals(seeAlso)){ mainOntologyMetadata.setSeeAlso(new ArrayList(Arrays.asList(seeAlso.split(";")))); } + String funders = propertyFile.getProperty(Constants.FUNDERS, ""); + if (!"".equals(funders)){ + String [] fundersURI = funders.split(";"); + for (String s : fundersURI) { + Agent a = new Agent(); + a.setName(s); + a.setURL(s); + mainOntologyMetadata.getFunders().add(a); + } + } + String funding = propertyFile.getProperty(Constants.FUNDING, ""); + if (!"".equals(funding)){ + mainOntologyMetadata.setFundingGrants(new ArrayList(Arrays.asList(funding.split(";")))); + } } catch (IOException ex) { // Only a warning, as we can continue safely without a property file. @@ -620,6 +638,9 @@ private void completeOntologyMetadata(OWLAnnotation a, OWLOntology o) { case Constants.PROP_DCTERMS_PUBLISHER: case Constants.PROP_SCHEMA_PUBLISHER_HTTP: case Constants.PROP_SCHEMA_PUBLISHER_HTTPS: + case Constants.PROP_SCHEMA_FUNDER_HTTP: + case Constants.PROP_SCHEMA_FUNDER_HTTPS: + case Constants.PROP_FOAF_FUNDED_BY: try { Agent ag = new Agent(); if (a.getValue().isLiteral()) { @@ -661,6 +682,13 @@ private void completeOntologyMetadata(OWLAnnotation a, OWLOntology o) { case Constants.PROP_SCHEMA_CREATOR_HTTPS: mainOntologyMetadata.getCreators().add(ag); break; + case Constants.PROP_SCHEMA_FUNDER_HTTP: + case Constants.PROP_SCHEMA_FUNDER_HTTPS: + case Constants.PROP_FOAF_FUNDED_BY: + if(ag.getURL() == null || ag.getURL().isEmpty()) + ag.setURL(ag.getName()); + mainOntologyMetadata.getFunders().add(ag); + break; default: mainOntologyMetadata.setPublisher(ag); break; @@ -702,6 +730,8 @@ private void completeOntologyMetadata(OWLAnnotation a, OWLOntology o) { break; case Constants.PROP_BIBO_STATUS: case Constants.PROP_MOD_STATUS: + case Constants.PROP_SCHEMA_STATUS_HTTP: + case Constants.PROP_SCHEMA_STATUS_HTTPS: value = "Specification Draft"; try { //if an object property is used, all valid status have the form http://purl.org/ontology/bibo/status/ @@ -750,10 +780,27 @@ private void completeOntologyMetadata(OWLAnnotation a, OWLOntology o) { value = WidocoUtils.getValueAsLiteralOrURI(a.getValue()); mainOntologyMetadata.getSources().add(value); break; + case Constants.PROP_SCHEMA_FUNDING_HTTP: + case Constants.PROP_SCHEMA_FUNDING_HTTPS: + value = WidocoUtils.getValueAsLiteralOrURI(a.getValue()); + mainOntologyMetadata.getFundingGrants().add(value); + break; case Constants.PROP_RDFS_SEE_ALSO: value = WidocoUtils.getValueAsLiteralOrURI(a.getValue()); mainOntologyMetadata.getSeeAlso().add(value); break; + case Constants.PROP_WIDOCO_INTRODUCTION: + try { + valueLanguage = a.getValue().asLiteral().get().getLang(); + value = a.getValue().asLiteral().get().getLiteral(); + if (this.currentLanguage.equals(valueLanguage) + || (introText == null || "".equals(introText))) { + introText = value; + } + } catch (Exception e) { + logger.error("Error while introduction annotation. No literal provided"); + } + break; } } @@ -1335,6 +1382,11 @@ public void setIncludeAllSectionsInOneDocument(boolean includeAllSectionsInOneDo this.includeAllSectionsInOneDocument = includeAllSectionsInOneDocument; } - - + public String getIntroText() { + return introText; + } + + public void setIntroText(String introText) { + this.introText = introText; + } } diff --git a/src/main/java/widoco/Constants.java b/src/main/java/widoco/Constants.java index 95a6042..37d4503 100644 --- a/src/main/java/widoco/Constants.java +++ b/src/main/java/widoco/Constants.java @@ -18,11 +18,7 @@ import diff.CompareOntologies; import diff.OntologyDifferencesRenderer; import java.io.File; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Properties; +import java.util.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,6 +73,7 @@ public class Constants { public static final String NS_MOD = "https://w3id.org/mod#"; public static final String NS_VOAF = "http://purl.org/vocommons/voaf#"; public static final String NS_WDRS = "http://www.w3.org/2007/05/powder-s#"; + public static final String NS_WIDOCO = "https://w3id.org/widoco/vocab#"; public static final String PROP_RDFS_LABEL = NS_RDFS + "label"; public static final String PROP_RDFS_COMMENT = NS_RDFS + "comment"; @@ -103,6 +100,10 @@ public class Constants { public static final String PROP_SCHEMA_DATE_MODIFIED_HTTPS = NS_SCHEMA_HTTPS + "dateModified"; public static final String PROP_SCHEMA_PUBLISHER_HTTP = NS_SCHEMA_HTTP + "publisher"; public static final String PROP_SCHEMA_PUBLISHER_HTTPS = NS_SCHEMA_HTTPS + "publisher"; + public static final String PROP_SCHEMA_FUNDER_HTTP = NS_SCHEMA_HTTP + "funder"; + public static final String PROP_SCHEMA_FUNDER_HTTPS = NS_SCHEMA_HTTPS + "funder"; + public static final String PROP_SCHEMA_FUNDING_HTTP = NS_SCHEMA_HTTP + "funding"; + public static final String PROP_SCHEMA_FUNDING_HTTPS = NS_SCHEMA_HTTPS + "funding"; public static final String PROP_SCHEMA_SCHEMA_VERSION_HTTP = NS_SCHEMA_HTTP + "schemaVersion"; public static final String PROP_SCHEMA_SCHEMA_VERSION_HTTPS = NS_SCHEMA_HTTPS + "schemaVersion"; public static final String PROP_SCHEMA_GIVEN_NAME_HTTP = NS_SCHEMA_HTTP + "givenName"; @@ -121,6 +122,8 @@ public class Constants { public static final String PROP_SCHEMA_DATE_ISSUED_HTTPS = NS_SCHEMA_HTTPS + "dateIssued"; public static final String PROP_SCHEMA_LOGO_HTTP = NS_SCHEMA_HTTP + "logo"; public static final String PROP_SCHEMA_LOGO_HTTPS = NS_SCHEMA_HTTPS + "logo"; + public static final String PROP_SCHEMA_STATUS_HTTP = NS_SCHEMA_HTTP + "creativeWorkStatus"; + public static final String PROP_SCHEMA_STATUS_HTTPS = NS_SCHEMA_HTTPS + "creativeWorkStatus"; public static final String PROP_OWL_VERSION_INFO = NS_OWL + "versionInfo"; public static final String PROP_OWL_PRIOR_VERSION = NS_OWL + "priorVersion"; @@ -197,12 +200,18 @@ public class Constants { public static final String PROP_FOAF_LOGO = NS_FOAF + "logo"; public static final String PROP_FOAF_IMAGE = NS_FOAF + "img"; public static final String PROP_FOAF_DEPICTION = NS_FOAF + "depiction"; + public static final String PROP_FOAF_FUNDED_BY = NS_FOAF + "fundedBy"; + public static final String PROP_ORG_MEMBER_OF = NS_ORG + "memberOf"; public static final String PROP_MOD_ACRONYM = NS_MOD + "acronym"; public static final String PROP_MOD_STATUS = NS_MOD + "status"; public static final String PROP_VOAF_EXTENDS = NS_VOAF + "extends"; - public static final String PROP_WDRS_IS_DESCRIBED_BY = NS_WDRS + "describedBy"; + public static final String PROP_WIDOCO_INTRODUCTION = NS_WIDOCO + "introduction"; + public static final String PROP_WIDOCO_RDF_XML= NS_WIDOCO + "rdfxmlSerialization"; + public static final String PROP_WIDOCO_NT= NS_WIDOCO + "nTSerialization"; + public static final String PROP_WIDOCO_TURTLE = NS_WIDOCO + "turtleSerialization"; + public static final String PROP_WIDOCO_JSON_LD = NS_WIDOCO + "jsonldSerialization"; @@ -255,6 +264,8 @@ public class Constants { public static final String PUBLISHER_INSTITUTION_URI = "publisherInstitutionURI"; public static final String SEE_ALSO = "seeAlso"; public static final String SOURCE = "source"; + public static final String FUNDERS = "funders"; + public static final String FUNDING = "fundingGrants"; public static final String SERIALIZATION_N3 = "N3Serialization"; public static final String SERIALIZATION_JSON = "JSONLDSerialization"; public static final String SERIALIZATION_RDF = "RDFXMLSerialization"; @@ -271,6 +282,7 @@ public class Constants { // 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_TITLE = "introTitle"; public static final String LANG_INTRO_PLACEHOLDER = "introPlaceHolder"; public static final String LANG_REFERENCES_PLACEHOLDER = "referencesPlaceHolder"; public static final String LANG_AUTHORS = AUTHORS; @@ -424,7 +436,15 @@ public static String getStatus(Configuration c) { } public static String getIntroductionSectionTitleAndPlaceHolder(Configuration c, Properties lang) { - String s = "

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

"; + //check if the content of the intro was found in a metadata property + if (c.getIntroText() == null || c.getIntroText().isEmpty()){ + s+= lang.getProperty(LANG_INTRO_PLACEHOLDER); + }else{ + s+= lang.getProperty(LANG_INTRO_TITLE); + s+= ""+ c.getIntroText() + "\n"; + } + return s; } @@ -509,6 +529,12 @@ private static String getContributors(ArrayList contrib, Properties l) { return c + "\n"; } + private static String getFunders(ArrayList contrib, Properties l) { + String c = "
" + l.getProperty(LANG_FUNDER) + "
\n"; + c += getAgents(contrib); + return c + "\n"; + } + private static String getPublisher(Agent publisher, Properties l) { if ((publisher.getName() != null && !"".equals(publisher.getName())) || (publisher.getURL() != null && !"".equals(publisher.getURL()))) { @@ -579,31 +605,15 @@ public static String stripTrailingNamespaceChars(String namespace) { public static String getNameSpaceDeclaration(HashMap namesp, Configuration c, Properties lang) { String ns = "
\n" + "

" + lang.getProperty(LANG_NS) + lang.getProperty(LANG_NS_TEXT); - Iterator keys = namesp.keySet().iterator(); String nsPrefix = c.getMainOntology().getNamespacePrefix(); String nsURI = c.getMainOntology().getNamespaceURI(); - ns += "" + nsPrefix + "<" + nsURI + ">\n"; - - // Leave a gap after the main ontology namespace, just so it stands out more (since it's the - // most important namespace). - // No need for us to check 'if there are any more prefixes', as the code currently always - // includes more anyway (whether they're actually referenced in the ontology or not (e.g., - // 'rdf', 'xsd', etc.)). I don't think the code should be doing this, but that's a tidy-up - // for another day! - ns += "\n"; - - // Strip off any trailing namespace characters from our main ontology namespace URI so that - // we are comparing like-for-like when removing duplicates. - final String nsURIStripped = stripTrailingNamespaceChars(nsURI); - - while (keys.hasNext()) { - String key = keys.next(); - - // Only add the namespace if it's not equal to the main ontology one (already added). - String currValue = stripTrailingNamespaceChars(namesp.get(key)); - if (!currValue.equals(nsURIStripped)) { - ns += "" + key + "<" + currValue + ">\n"; - } + //order all ns alphabetically + if (!namesp.containsKey(nsPrefix)){ + namesp.put(nsPrefix,stripTrailingNamespaceChars(nsURI)); + } + TreeMap sortedMap = new TreeMap<>(namesp); + for (Map.Entry entry : sortedMap.entrySet()) { + ns += "" + entry.getKey() + "<" + entry.getValue() + ">\n"; } ns += "\n" + "\n" + "

\n" + "\n"; @@ -760,19 +770,44 @@ public static String getIndexDocument(String resourcesFolderName, Configuration + " };" + " $(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.isIncludeAbstract()) { + if(c.getAbstractPath()!=null && !c.getAbstractPath().isEmpty()){ + document += " $(\"#abstract\").load(\""+c.getAbstractPath()+"\"); \n"; + }else { + document += " $(\"#abstract\").load(\"sections/abstract-" + c.getCurrentLanguage() + ".html\"); \n"; + } + } + if (c.isIncludeIntroduction()){ + if(c.getIntroductionPath()!=null && !c.getIntroductionPath().isEmpty()){ + document += " $(\"#introduction\").load(\""+c.getIntroductionPath()+"\"); \n"; + }else { + document += " $(\"#introduction\").load(\"sections/introduction-" + c.getCurrentLanguage() + + ".html\"); \n"; + } + } + if (c.isIncludeOverview()){ + if(c.getOverviewPath()!=null && !c.getOverviewPath().isEmpty()){ + document += " $(\"#overview\").load(\""+c.getOverviewPath()+"\"); \n"; + }else { + document += " $(\"#overview\").load(\"sections/overview-" + c.getCurrentLanguage() + ".html\"); \n"; + } + } + if (c.isIncludeDescription()){ + if(c.getDescriptionPath()!=null && !c.getDescriptionPath().isEmpty()){ + document += " $(\"#description\").load(\""+c.getDescriptionPath()+"\"); \n"; + }else { + document += " $(\"#description\").load(\"sections/description-" + c.getCurrentLanguage() + + ".html\"); \n"; + } + } + if (c.isIncludeReferences()){ + if(c.getReferencesPath()!=null && !c.getReferencesPath().isEmpty()){ + document += " $(\"#references\").load(\""+c.getReferencesPath()+"\"); \n"; + }else { + document += " $(\"#references\").load(\"sections/references-" + c.getCurrentLanguage() + + ".html\"); \n"; + } + } if (c.isIncludeChangeLog()) { if (c.getMainOntology().getPreviousVersion() != null && !"".equals(c.getMainOntology().getPreviousVersion()) && c.isChangeLogSuccessfullyCreated()) { @@ -962,6 +997,10 @@ public static String getHeadSection(Configuration c, Properties l) { head += getURLs(c.getMainOntology().getSources(), l.getProperty(Constants.LANG_SOURCES)) + "\n"; if (!c.getMainOntology().getSeeAlso().isEmpty()) head += getURLs(c.getMainOntology().getSeeAlso(), l.getProperty(Constants.LANG_SEE_ALSO)) + "\n"; + if (!c.getMainOntology().getFunders().isEmpty()) + head += getFunders(c.getMainOntology().getFunders(), l) + "\n"; + if (!c.getMainOntology().getFundingGrants().isEmpty()) + head += getURLs(c.getMainOntology().getFundingGrants(), l.getProperty(Constants.LANG_FUNDING)) + "\n"; if (c.isDisplaySerializations()) { HashMap availableSerializations = c.getMainOntology().getSerializations(); diff --git a/src/main/java/widoco/CreateResources.java b/src/main/java/widoco/CreateResources.java index 04d2716..b7fa10a 100644 --- a/src/main/java/widoco/CreateResources.java +++ b/src/main/java/widoco/CreateResources.java @@ -386,19 +386,22 @@ public static void saveDocument(String path, String textToWrite, Configuration c Writer out = null; try { if (f.exists()) { - // JOptionPane.showMessageDialog(null, "You have overwritten the previous file. - // This message should be better prepared."); - if (!c.getOverWriteAll()) { - String[] options = new String[] { "Rewrite all", "Yes", "No" }; - int response = JOptionPane.showOptionDialog(null, - "The file " + f.getName() + " already exists. Do you want to overwrite it?", - "Existing File!", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, - options, options[0]); - // 0 -> yes to all. 1 -> Yes. 2-> No - if (response == 0) - c.setOverwriteAll(true); - if (response == 2) - return; // else we continue rewriting the file. + try { + if (!c.getOverWriteAll()) { + String[] options = new String[]{"Rewrite all", "Yes", "No"}; + int response = JOptionPane.showOptionDialog(null, + "The file " + f.getName() + " already exists. Do you want to overwrite it?", + "Existing File!", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, + options, options[0]); + // 0 -> yes to all. 1 -> Yes. 2-> No + if (response == 0) + c.setOverwriteAll(true); + if (response == 2) + return; // else we continue rewriting the file. + } + }catch (Exception e){ + logger.error("It looks like WIDOCO tried to save the documentation, but files already exist. Please " + + "try using the -rewriteAll option."); } } else { f.createNewFile(); @@ -634,7 +637,7 @@ public static void saveConfigFile(String path, Configuration conf) throws IOExce if (serializations.containsKey("JSON-LD")) { textProperties += Constants.SERIALIZATION_JSON + "=" + serializations.get("JSON-LD") + "\n"; } - String images = "", sources = "", seeAlso = ""; + String images = "", sources = "", seeAlso = "", funding = "", funder = ""; ArrayList imgs = conf.getMainOntology().getImages(); if (!imgs.isEmpty()){ for (int i = 0; i < imgs.size() - 1; i++) { @@ -659,6 +662,22 @@ public static void saveConfigFile(String path, Configuration conf) throws IOExce seeAlso += see.get(see.size() - 1) ; } textProperties += Constants.SEE_ALSO + "=" + seeAlso + "\n"; + ArrayList fund = conf.getMainOntology().getFundingGrants(); + if (!fund.isEmpty()){ + for (int i = 0; i < fund.size() - 1; i++) { + funding += fund.get(i) + ";"; + } + funding += fund.get(fund.size() - 1) ; + } + textProperties += Constants.FUNDING + "=" + funding + "\n"; + ArrayList funders = conf.getMainOntology().getFunders(); + if (!funders.isEmpty()){ + for (int i = 0; i < funders.size() - 1; i++) { + funding += funders.get(i).getName() + ";"; + } + funding += funders.get(fund.size() - 1).getName() ; //name is a URL in this case + } + textProperties += Constants.FUNDERS + "=" + funders + "\n"; // copy the result into the file Writer writer = null; try { diff --git a/src/main/java/widoco/gui/BiggerTextArea.java b/src/main/java/widoco/gui/BiggerTextArea.java index bb42429..f2eb351 100644 --- a/src/main/java/widoco/gui/BiggerTextArea.java +++ b/src/main/java/widoco/gui/BiggerTextArea.java @@ -8,7 +8,7 @@ * @author dgarijo */ public class BiggerTextArea extends javax.swing.JFrame { - public enum PropertyType{abs, description, citeAs}; + public enum PropertyType{abs, description, introduction, citeAs}; private final GuiStep2 step2Gui; private final Configuration c; @@ -45,6 +45,9 @@ public BiggerTextArea(GuiStep2 g, Configuration c, PropertyType type) { case description: this.setTitle("Complete description"); textArea.setText(c.getMainOntology().getDescription()); break; + case introduction: this.setTitle("Complete introduction"); + textArea.setText(c.getIntroText()); + break; case citeAs: this.setTitle("Complete citation"); textArea.setText(c.getMainOntology().getCiteAs()); break; @@ -134,6 +137,8 @@ private void buttonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS break; case description:this.c.getMainOntology().setDescription(textArea.getText()); break; + case introduction:this.c.setIntroText(textArea.getText()); + break; case citeAs:this.c.getMainOntology().setCiteAs(textArea.getText()); break; } diff --git a/src/main/java/widoco/gui/EditProperty.java b/src/main/java/widoco/gui/EditProperty.java index 2eaddcf..9e30ac1 100644 --- a/src/main/java/widoco/gui/EditProperty.java +++ b/src/main/java/widoco/gui/EditProperty.java @@ -2,7 +2,6 @@ import java.awt.Dimension; import java.util.ArrayList; -import java.util.Iterator; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import widoco.Configuration; @@ -16,7 +15,8 @@ */ public class EditProperty extends javax.swing.JFrame { - public enum PropertyType{authors, contributors, publisher, extended, imported, license, image, source, seeAlso}; + public enum PropertyType{authors, contributors, funders, publisher, extended, imported, license, image, source, + seeAlso, funding}; private final GuiStep2 step2Gui; private final Configuration c; private final PropertyType type; @@ -56,6 +56,13 @@ public EditProperty(GuiStep2 g, Configuration c, PropertyType p) { createTable(new String[]{"Name","URI","email","Institution Name", "Institution URI"}); loadAgents(c.getMainOntology().getContributors()); break; + case funders: + this.setTitle("Editing Funders"); + this.addRowButton.setText("Add funder..."); + this.deleteRowButton.setText("Delete funder..."); + createTable(new String[]{"Name","URI","email","Institution Name", "Institution URI"}); + loadAgents(c.getMainOntology().getFunders()); + break; case publisher: this.setTitle("Editing Publisher"); createTable(new String[]{"Name","URI","email","Institution Name","Institution URI"}); @@ -100,6 +107,13 @@ public EditProperty(GuiStep2 g, Configuration c, PropertyType p) { createTable(new String[]{"Resource URL"}); loadResources(c.getMainOntology().getSeeAlso()); break; + case funding: + this.setTitle("Editing funding grants"); + this.addRowButton.setText("Add grant..."); + this.deleteRowButton.setText("Delete grant..."); + createTable(new String[]{"Grant URL"}); + loadResources(c.getMainOntology().getFundingGrants()); + break; case source: this.setTitle("Editing Sources"); this.addRowButton.setText("Add source..."); diff --git a/src/main/java/widoco/gui/GuiStep1.java b/src/main/java/widoco/gui/GuiStep1.java index 0a2bac5..b651712 100644 --- a/src/main/java/widoco/gui/GuiStep1.java +++ b/src/main/java/widoco/gui/GuiStep1.java @@ -21,18 +21,15 @@ */ package widoco.gui; -import java.awt.Dimension; -import java.awt.Image; +import java.awt.*; import java.io.File; import java.net.URL; import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JOptionPane; -import javax.swing.filechooser.FileFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,6 +42,7 @@ 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; + private Dimension dim; /** * Creates new form WidocoGui2 @@ -70,7 +68,7 @@ private void initializeGUI() { buttonGroup.add(option1); buttonGroup.add(option2); buttonGroup.add(option3); - Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); // Determine the new location of the window int w = this.getSize().width; @@ -205,7 +203,7 @@ public void keyTyped(java.awt.event.KeyEvent evt) { } }); - textDocPath.setEditable(false); + //textDocPath.setEditable(false); textDocPath.setHorizontalAlignment(javax.swing.JTextField.TRAILING); textDocPath.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -406,14 +404,14 @@ private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN JOptionPane.showMessageDialog(this, "The selected folder does not exist! Please select a folder"); return; } - // no need to check if the file is a foder, as we ensure this with the + // no need to check if the file is a folder, as we ensure this with the // "directories_only" property this.textDocPath.setText(folderPath + File.separator + this.textDocName.getText()); } - }// GEN-LAST:event_browseButtonActionPerformed + } private void textDocPathActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_textDocPathActionPerformed - // TODO add your handling code here: + }// GEN-LAST:event_textDocPathActionPerformed private void textDocNameKeyTyped(java.awt.event.KeyEvent evt) {// GEN-FIRST:event_textDocNameKeyTyped @@ -443,29 +441,20 @@ private void option2ItemStateChanged(java.awt.event.ItemEvent evt) {// GEN-FIRST private void option1ItemStateChanged(java.awt.event.ItemEvent evt) {// GEN-FIRST:event_option1ItemStateChanged if (option1.isSelected()) { - JFileChooser chooser = new JFileChooser(new File("").getAbsolutePath()); - chooser.setName("Select OWL File"); - // no need to create an additional class, as we will use this filter only here. - chooser.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - if (f.isDirectory()) { - return true; - } - return f.getName().endsWith(".owl") || f.getName().endsWith(".rdf") || f.getName().endsWith(".json") - || f.getName().endsWith(".jsonld") || f.getName().endsWith(".ttl"); - } - - @Override - public String getDescription() { - return null; - } - }); - // chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - int returnVal = chooser.showOpenDialog(this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - logger.info("You chose to save this file: " + chooser.getSelectedFile().getName()); - this.textFieldPath.setText(chooser.getSelectedFile().getAbsolutePath()); + FileDialog selectFileDialog = new FileDialog(this, "Select OWL File", FileDialog.LOAD); + selectFileDialog.setFilenameFilter((dir, name) -> + name.endsWith(".owl") || name.endsWith(".rdf") || name.endsWith(".json") || + name.endsWith(".jsonld") || name.endsWith(".ttl") + ); + selectFileDialog.setVisible(true); + String directory = selectFileDialog.getDirectory(); + String file = selectFileDialog.getFile(); + if (directory != null && file != null) { + File selectedFile = new File(directory, file); + logger.info("You chose to save this file: " + selectedFile.getName()); + this.textFieldPath.setText(selectedFile.getAbsolutePath()); + } else { + logger.info("Selection canceled."); } } diff --git a/src/main/java/widoco/gui/GuiStep2.java b/src/main/java/widoco/gui/GuiStep2.java index 43f4df0..b30c135 100644 --- a/src/main/java/widoco/gui/GuiStep2.java +++ b/src/main/java/widoco/gui/GuiStep2.java @@ -21,10 +21,7 @@ */ package widoco.gui; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Image; -import java.awt.Toolkit; +import java.awt.*; import java.io.File; import java.io.IOException; import java.net.URI; @@ -125,6 +122,9 @@ public void mouseClicked(java.awt.event.MouseEvent evt) { case "ontology description": form = new BiggerTextArea(gAux, conf, BiggerTextArea.PropertyType.description); break; + case "ontology introduction": + form = new BiggerTextArea(gAux, conf, BiggerTextArea.PropertyType.introduction); + break; case "cite as": form = new BiggerTextArea(gAux, conf, BiggerTextArea.PropertyType.citeAs); break; @@ -134,6 +134,9 @@ public void mouseClicked(java.awt.event.MouseEvent evt) { case "contributors": form = new EditProperty(gAux, conf, EditProperty.PropertyType.contributors); break; + case "funders": + form = new EditProperty(gAux, conf, EditProperty.PropertyType.funders); + break; case "publisher": form = new EditProperty(gAux, conf, EditProperty.PropertyType.publisher); break; @@ -155,6 +158,9 @@ public void mouseClicked(java.awt.event.MouseEvent evt) { case "sources": form = new EditProperty(gAux, conf, EditProperty.PropertyType.source); break; + case "funding": + form = new EditProperty(gAux, conf, EditProperty.PropertyType.funding); + break; } if (form != null) { gAux.saveMetadata(); @@ -194,6 +200,8 @@ private void refreshTable() { StringBuilder images = new StringBuilder(); StringBuilder sources = new StringBuilder(); StringBuilder seeAlso = new StringBuilder(); + StringBuilder funders = new StringBuilder(); + StringBuilder funding = new StringBuilder(); for (Agent a : conf.getMainOntology().getCreators()) { if (a.getName() == null || a.getName().equals("")) { authors.append("creator; "); @@ -208,6 +216,13 @@ private void refreshTable() { contributors.append(a.getName()).append("; "); } } + for (Agent a : conf.getMainOntology().getFunders()) { + if (a.getName() == null || a.getName().equals("")) { + funders.append("funding; "); + } else { + funders.append(a.getName()).append("; "); + } + } for (Ontology a : conf.getMainOntology().getImportedOntologies()) { if (a.getName() == null || a.getName().equals("")) { imported.append("importedOnto; "); @@ -245,11 +260,17 @@ private void refreshTable() { seeAlso.append(see).append(";"); } } + for (String see: conf.getMainOntology().getFundingGrants()){ + if(!see.equals("")){ + funding.append(see).append(";"); + } + } tableProperties.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { "abstract", conf.getAbstractSection() }, { "ontology title", conf.getMainOntology().getTitle() }, { "ontology name", conf.getMainOntology().getName() }, { "ontology description", conf.getMainOntology().getDescription() }, + { "ontology introduction", conf.getIntroText() }, { "ontology prefix", conf.getMainOntology().getNamespacePrefix() }, { "ontology ns URI", conf.getMainOntology().getNamespaceURI() }, { "creation date", conf.getMainOntology().getCreationDate() }, @@ -260,6 +281,7 @@ private void refreshTable() { { "ontology revision", conf.getMainOntology().getRevision() }, { "authors", authors.toString()}, { "contributors", contributors.toString()}, + { "funders", funders.toString()}, { "publisher", publisher.toString() }, { "imported ontologies", imported.toString()}, { "extended ontologies", extended.toString()}, @@ -272,6 +294,7 @@ private void refreshTable() { { "images", images.toString()}, { "logo", conf.getMainOntology().getLogo() }, { "sources", sources.toString() }, + { "funding", funding.toString() }, { "see also", seeAlso.toString() } }, new String[] { "Property", "Value" }) { @@ -286,16 +309,19 @@ public Class getColumnClass(int columnIndex) { @Override public boolean isCellEditable(int rowIndex, int columnIndex) { if (getValueAt(rowIndex, 0).equals("abstract") + || getValueAt(rowIndex, 0).equals("ontology introduction") || getValueAt(rowIndex, 0).equals("ontology description") || getValueAt(rowIndex, 0).equals("cite as") || getValueAt(rowIndex, 0).equals("authors") || getValueAt(rowIndex, 0).equals("contributors") || getValueAt(rowIndex, 0).equals("publisher") + || getValueAt(rowIndex, 0).equals("funders") || ((String) getValueAt(rowIndex, 0)).toLowerCase().contains("extended") || ((String) getValueAt(rowIndex, 0)).toLowerCase().contains("license") || ((String) getValueAt(rowIndex, 0)).toLowerCase().contains("images") || ((String) getValueAt(rowIndex, 0)).toLowerCase().contains("see also") || ((String) getValueAt(rowIndex, 0)).toLowerCase().contains("source") + || ((String) getValueAt(rowIndex, 0)).toLowerCase().contains("funding") || ((String) getValueAt(rowIndex, 0)).toLowerCase().contains("imported")) { return false; } @@ -329,6 +355,8 @@ private void saveMetadata() { break; case "ontology description": conf.getMainOntology().setDescription(value); + case "ontology introduction": + conf.setIntroText(value); case "ontology prefix": conf.getMainOntology().setNamespacePrefix(value); break; @@ -458,6 +486,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { labelSteps.setText("Steps"); tableProperties.setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { "abstract", "" }, { "ontology title", null }, { "ontology name", null }, + { "ontology description", null }, { "ontology introduction", null }, { "ontology prefix", null }, { "ontology ns URI", null }, { "creation date", null }, { "modified date", null }, { "this version URI", null }, { "latest version URI", null }, { "previous version URI", null }, { "ontology revision", null }, { "authors", null }, @@ -751,12 +780,23 @@ private void loadMetadataButtonActionPerformed(java.awt.event.ActionEvent evt) { this.useLicensiusWSCheckBox.setEnabled(false); this.loadMetadataFromOnto.setSelected(false); this.loadMetadataFromDefaultConfigFile.setSelected(false); - JFileChooser chooser = new JFileChooser(new File("").getAbsolutePath()); - int returnVal = chooser.showOpenDialog(this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - // g.reloadConfiguration(chooser.getSelectedFile().getAbsolutePath()); - conf.reloadPropertyFile(chooser.getSelectedFile().getAbsolutePath()); +// JFileChooser chooser = new JFileChooser(new File("").getAbsolutePath()); +// int returnVal = chooser.showOpenDialog(this); +// if (returnVal == JFileChooser.APPROVE_OPTION) { +// // g.reloadConfiguration(chooser.getSelectedFile().getAbsolutePath()); +// conf.reloadPropertyFile(chooser.getSelectedFile().getAbsolutePath()); +// this.refreshPropertyTable(); +// } + FileDialog chooser = new FileDialog(this, "Select .properties file", FileDialog.LOAD); + chooser.setVisible(true); + String directory = chooser.getDirectory(); + String file = chooser.getFile(); + if (directory != null && file != null) { + File selectedFile = new File(directory, file); + conf.reloadPropertyFile(selectedFile.getAbsolutePath()); this.refreshPropertyTable(); + } else { + logger.info("Load canceled."); } }// GEN-LAST:event_loadMetadataButtonActionPerformed @@ -793,18 +833,34 @@ private void loadMetadataFromDefaultConfigFileActionPerformed(java.awt.event.Act private void saveMetadataButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_saveMetadataButtonActionPerformed saveMetadata(); - // ideally the serialization of config woule have to be done in another class. - JFileChooser chooser = new JFileChooser(); - int returnVal = chooser.showSaveDialog(this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - // create a file (if not exists already) - String path = chooser.getSelectedFile().getAbsolutePath(); +// JFileChooser chooser = new JFileChooser(); +// int returnVal = chooser.showSaveDialog(this); +// if (returnVal == JFileChooser.APPROVE_OPTION) { +// // create a file (if not exists already) +// String path = chooser.getSelectedFile().getAbsolutePath(); +// try { +// CreateResources.saveConfigFile(path, conf); +// JOptionPane.showMessageDialog(this, "Property file saved successfully"); +// } catch (IOException e) { +// JOptionPane.showMessageDialog(this, "Error while saving the property file "); +// } +// } + + FileDialog chooser = new FileDialog(this, "Select A file to save all ontology metadata", FileDialog.SAVE); + chooser.setVisible(true); + String directory = chooser.getDirectory(); + String file = chooser.getFile(); + if (directory != null && file != null) { + File selectedFile = new File(directory, file); + logger.info("You chose to save this file: " + selectedFile.getName()); try { - CreateResources.saveConfigFile(path, conf); + CreateResources.saveConfigFile(selectedFile.getAbsolutePath(), conf); JOptionPane.showMessageDialog(this, "Property file saved successfully"); } catch (IOException e) { JOptionPane.showMessageDialog(this, "Error while saving the property file "); } + } else { + logger.info("Selection canceled."); } }// GEN-LAST:event_saveMetadataButtonActionPerformed diff --git a/src/main/java/widoco/gui/GuiStep3.java b/src/main/java/widoco/gui/GuiStep3.java index 834bf0c..8c7ea11 100644 --- a/src/main/java/widoco/gui/GuiStep3.java +++ b/src/main/java/widoco/gui/GuiStep3.java @@ -21,10 +21,11 @@ */ package widoco.gui; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Image; -import java.awt.Toolkit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.awt.*; +import java.io.File; import java.net.URI; import java.net.URISyntaxException; import javax.swing.ImageIcon; @@ -37,6 +38,7 @@ */ public class GuiStep3 extends javax.swing.JFrame { private final GuiController g; + private final Logger logger = LoggerFactory.getLogger(this.getClass()); private String abstractPath; private String introductionPath; private String overviewPath; @@ -275,11 +277,11 @@ public void mouseExited(java.awt.event.MouseEvent evt) { checkBoxDisplaySerialization.setSelected(true); checkBoxDisplaySerialization.setText("Display ontology serializations"); - checkBoxDisplaySerialization.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - checkBoxDisplaySerializationActionPerformed(evt); - } - }); +// checkBoxDisplaySerialization.addActionListener(new java.awt.event.ActionListener() { +// public void actionPerformed(java.awt.event.ActionEvent evt) { +// checkBoxDisplaySerializationActionPerformed(evt); +// } +// }); buttonRewriteBase.setText("Set base path"); buttonRewriteBase.addActionListener(new java.awt.event.ActionListener() { @@ -580,9 +582,7 @@ private void abstractSectionButtonActionPerformed(java.awt.event.ActionEvent evt abstractPath = loadSection(); }//GEN-LAST:event_abstractSectionButtonActionPerformed - private void checkBoxDisplaySerializationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxDisplaySerializationActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_checkBoxDisplaySerializationActionPerformed + private void buttonRewriteBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRewriteBaseActionPerformed String newRewriteBase = JOptionPane.showInputDialog(this, "New rewrite base path for .htaccess",g.getConfig().getRewriteBase()); @@ -592,10 +592,19 @@ private void buttonRewriteBaseActionPerformed(java.awt.event.ActionEvent evt) {/ }//GEN-LAST:event_buttonRewriteBaseActionPerformed private String loadSection(){ - JFileChooser chooser = new JFileChooser(); - int returnVal = chooser.showSaveDialog(this); - if(returnVal == JFileChooser.APPROVE_OPTION) { - return chooser.getSelectedFile().getAbsolutePath(); +// JFileChooser chooser = new JFileChooser(); +// int returnVal = chooser.showSaveDialog(this); +// if(returnVal == JFileChooser.APPROVE_OPTION) { +// return chooser.getSelectedFile().getAbsolutePath(); +// } + FileDialog chooser = new FileDialog(this, "Select file to load", FileDialog.LOAD); + chooser.setVisible(true); + String directory = chooser.getDirectory(); + String file = chooser.getFile(); + if (directory != null && file != null) { + File selectedFile = new File(directory, file); + logger.info("Saving selection to "+selectedFile.getAbsolutePath()); + return selectedFile.getAbsolutePath(); } return null; } diff --git a/src/main/resources/lode.zip b/src/main/resources/lode.zip index b9c8091..a812b01 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 c1389c7..8e95fb2 100644 --- a/src/main/resources/lode/extraction.xsl +++ b/src/main/resources/lode/extraction.xsl @@ -501,7 +501,7 @@ http://www.oxygenxml.com/ns/doc/xsl ">
  • - + + + + + + + + + + + + + + + + + + +
  • @@ -637,11 +656,33 @@ http://www.oxygenxml.com/ns/doc/xsl "> + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + +

    @@ -2283,7 +2337,7 @@ http://www.oxygenxml.com/ns/doc/xsl ">

    - + @@ -2294,7 +2348,7 @@ http://www.oxygenxml.com/ns/doc/xsl ">
      - + diff --git a/src/main/resources/widoco/cs.properties b/src/main/resources/widoco/cs.properties index 1c4eaa5..f97fdca 100644 --- a/src/main/resources/widoco/cs.properties +++ b/src/main/resources/widoco/cs.properties @@ -18,7 +18,7 @@ licenseURLIfNull=http://vlozUriLicenceZde.example.org toc=Obsah ns=Deklarace jmenn\u00fdch prostor\u016f nsText=

    \n
    \n\n\n\n -introTitle=\u00davod +introTitle=\u00davod zp\u011bt k obsahu\n 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 diff --git a/src/main/resources/widoco/de.properties b/src/main/resources/widoco/de.properties index 81d9ac9..621d0e7 100644 --- a/src/main/resources/widoco/de.properties +++ b/src/main/resources/widoco/de.properties @@ -18,7 +18,7 @@ licenseURLIfNull=http://insertlicenseURIhere.example.org toc=Inhaltsverzeichnis ns=Namensräume nsText=\n
    \n
    Table 1: Jmenn\u00e9 prostory pou\u017eit\u00e9 v tomto dokumentut
    \n\n\n -introTitle=Einführung +introTitle=Einführung zurück zum Inhaltsverzeichnis\n introPlaceHolder=Einführung zurück zum Inhaltsverzeichnis\n\nDies ist ein Platzhalter für die Einführung. Die Einführung sollte in kurzer Form die Ontologie und ihren Anwendungszweck beschreiben, sowie Informationen über ihren Entwicklungsstand und Kontext enthalten.\n namespace=Deklaration der Namensräume overviewTitle=überblick diff --git a/src/main/resources/widoco/en.properties b/src/main/resources/widoco/en.properties index bb30747..b185f8e 100644 --- a/src/main/resources/widoco/en.properties +++ b/src/main/resources/widoco/en.properties @@ -18,7 +18,7 @@ licenseURLIfNull=http://insertlicenseURIhere.example.org toc=Table of contents ns=Namespace declarations nsText=\n
    \n
    Tabelle 1: Namensräume im Dokument
    \n\n\n -introTitle=Introduction +introTitle=Introduction back to ToC\n introPlaceHolder=Introduction back to ToC\n\nThis is a place holder text for the introduction. The introduction should briefly describe the ontology, its motivation, state of the art and goals.\n namespace=Namespace declarations overviewTitle=Overview diff --git a/src/main/resources/widoco/es.properties b/src/main/resources/widoco/es.properties index e066a42..d5a1e73 100644 --- a/src/main/resources/widoco/es.properties +++ b/src/main/resources/widoco/es.properties @@ -18,7 +18,7 @@ licenseURLIfNull=http://tituloLicenciaSeleccionado.example.org toc=Índice ns=Declaración de namespaces nsText=\n
    \n
    Table 1: Namespaces used in the document
    \n\n\n -introTitle=Introducción +introTitle=Introducción volver a índice\n introPlaceHolder=Introducción volver a índice\nEste párrafo debería hablar sobre la ontología, motivación estado del arte y objetivos\n namespace=Namespaces utlizados en el documento overviewTitle=Resumen diff --git a/src/main/resources/widoco/fr.properties b/src/main/resources/widoco/fr.properties index 97a552d..83d12a7 100644 --- a/src/main/resources/widoco/fr.properties +++ b/src/main/resources/widoco/fr.properties @@ -18,7 +18,7 @@ licenseURLIfNull=http://URIdelalicence.example.org toc=Sommaire ns=Espaces de noms déclarés nsText=\n
    \n
    Tabla 1: Namespaces utilizados en el documento
    \n\n\n -introTitle=Introduction +introTitle=Introduction retour au sommaire\n introPlaceHolder=Introduction retour au sommaire\n\nCeci est une introduction automatique. L'introduction doit décrire briè vement l'ontologie, motiver son développement, l'état de l'art, les objectifs.\n namespace=Déclarations d'espaces de noms overviewTitle=Aperçu diff --git a/src/main/resources/widoco/it.properties b/src/main/resources/widoco/it.properties index fd33483..5b064b4 100644 --- a/src/main/resources/widoco/it.properties +++ b/src/main/resources/widoco/it.properties @@ -23,7 +23,7 @@ licenseURLIfNull=http://insertlicenseURIhere.example.org toc=Table of contents ns=Lista dei namespace nsText=\n
    \n
    Table 1: Espaces de noms utilisés dans ce document
    \n\n\n -introTitle=Introduzione +introTitle=Introduzione torna alla ToC\n introPlaceHolder=Introduzione torna alla ToC\n\nQui va inserita l'introduzione. L'introduzione dovrebbe descrivere brevemente l'ontologia, le motivazioni, lo stato dell'arte, e gli obiettivi.\n namespace=Dichiarazione dei namespace overviewTitle=Overview diff --git a/src/main/resources/widoco/nl.properties b/src/main/resources/widoco/nl.properties index 6a4ab1a..ba2f10f 100644 --- a/src/main/resources/widoco/nl.properties +++ b/src/main/resources/widoco/nl.properties @@ -18,7 +18,7 @@ licenseURLIfNull=http://voeglicentieURIhiertoe.example.org toc=Inhoudsopgave ns=Naamruimtedefinities nsText=\n
    \n
    Tabella 1: Lista dei namespace usati nel documento
    \n\n\n -introTitle=Inleiding +introTitle=Inleiding terug naar Index\n introPlaceHolder=Inleiding terug naar Index\n\nDit is een tijdelijke tekst voor de inleiding. De inleiding moet kort de ontologie, de motivatie, de stand van de techniek en de doelen beschrijven.\n namespace=Naamruimtedefinities overviewTitle=Overzicht diff --git a/src/main/resources/widoco/pt.properties b/src/main/resources/widoco/pt.properties index 633f670..27e8aff 100644 --- a/src/main/resources/widoco/pt.properties +++ b/src/main/resources/widoco/pt.properties @@ -18,7 +18,7 @@ licenseURLIfNull=http://insertlicenseURIhere.example.org toc=Índice ns=Declarações de namespaces nsText=\n
    \n
    Table 1: Gebruikte naamruimten in dit document
    \n\n\n -introTitle=Introdução +introTitle=Introdução de volta a índice\n introPlaceHolder=Introdução de volta a índice\nIsso deve falar um pouco sobre sua ontologia, a sua motivação, soa e objetivos.\n namespace=Namespaces utilizados no documento overviewTitle=Visão geral
    Table 1: Namespaces utilizados no documento