Skip to content

Commit

Permalink
Fix #645
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarijo committed Apr 4, 2024
1 parent 969628c commit a6905c3
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 73 deletions.
18 changes: 18 additions & 0 deletions doc/bestPractices/sections/checklist-en.html
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,24 @@ <h5>Example:</h5>
rdfs:seeAlso &lt;http://www.wikipathways.org/&gt; .
</pre>

<h3 id="code" class="list">Code repository (vocabulary maintenance) [<em class="rfc2119" title="OPTIONAL">OPTIONAL</em>]</h3>
<p>
Property used to indicate if there is a public code repository where the vocabulary is maintained. This information may be helpful to the adopter of your vocabulary, in order to raise issues and see current discussions.
</p>

<ul class="hlist"><strong>Properties you may use</strong>:
<li><a target="_blank" href="http://schema.org/codeRepository">schema:codeRepository</a> <strong>(PREFERRED)</strong></li>
<li><a target="_blank" href="http://usefulinc.com/ns/doap#repository">doap:repository</a></li>
</ul>

<h5>Example:</h5>
<pre>
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
&lt;http://vocabularies.wikipathways.org/wpTypes#&gt; a owl:Ontology ;
schema:codeRepository "https://github.com/user/repo"^^xsd:anyURI; .
</pre>


<h2 id="desc-term" class="list">Term checklist of metadata properties <span class="backlink"> back to <a href="#toc">ToC</a></span></h2>
These metadata terms are targeted towards describing the classes, properties and data properties of the ontology. Adding them as part of the ontology is crucial for potential reusers:
Expand Down
5 changes: 3 additions & 2 deletions doc/bestPractices/sections/introduction-en.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ <h2 id="conv" class="list">Properties summary</h2>
<ul class="hlist" id="opt">
<li><a href="#abs">abstract</a></li>
<li><a href="#backwardCompatibility">backward compatibility</a></li>
<li><a href="#biblio">bibliographic Citation</a></li>
<li><a href="#biblio">bibliographic citation</a></li>
<li><a href="#code">code repository</a></li>
<li><a href="#diagram">diagram</a></li>
<li><a href="#doi">DOI</a></li>
<li><a href="#extended">extended Ontologies</a></li>
Expand All @@ -80,7 +81,7 @@ <h2 id="conv" class="list">Properties summary</h2>
<li><a href="#incompatibility">incompatibility</a></li>
<li><a href="#issuedDate">issued date</a></li>
<li><a href="#logo">logo</a></li>
<li><a href="#modificationDate">modification Date</a></li>
<li><a href="#modificationDate">modification date</a></li>
<li><a href="#publisher">publisher</a></li>
<li><a href="#similar">see also</a></li>
<li><a href="#source">source</a></li>
Expand Down
9 changes: 5 additions & 4 deletions doc/configuration/config.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@

abstract=An example ontology
backwardCompatibleWith=https://w3id.org/example/1.0.0
citeAs="add some citation text here."
dateCreated="13 Nov, 2022"
dateModified="15 Nov, 2022"
authors=First Author;Second Author
authorsURI=http://example.org/author1;http://example.org/author2
authorsInstitution=First author institution;Second author institution
authorsInstitutionURI=https://www.isi.edu/;https://www.isi.edu/
citeAs="add some citation text here."
backwardCompatibleWith=https://w3id.org/example/1.0.0
codeRepository=https://github.com/dgarijo/example
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/
dateCreated="13 Nov, 2022"
dateModified="15 Nov, 2022"
description="A description of what the ontology does goes here"
diagram="https://example.org/diagram.svg"
DOI=
Expand Down
8 changes: 7 additions & 1 deletion doc/metadataGuide/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ The table below shows which ontology metadata annotations are recognized in WIDO
|Abstract |[dc:abstract], [dcterms:abstract]|abstract |[Sec 3.2.4] **[OPTIONAL]**|[Text]|[ontology](#onto), [config]|
|Backwards compatible|[owl:backwardCompatibleWith] |backwardCompatibleWith|[Sec 3.3.3] **[OPTIONAL]**|[URI] |[ontology](#onto), [config]|
|Bibliographic citation|[dcterms:bibliographicCitation], [schema:citation]|citeAs|[Sec 3.6.2] **[OPTIONAL]**|[Text]|[ontology](#onto), [config]|
|Code repository|[schema:codeRepository], [doap:repository]|codeRepository|[Sec 3.10] **[OPTIONAL]**|[URI]|[ontology](#onto), [config]|
|Contributors|[dcterms:contributor], [dc:contributor], [schema:contributor], [pav:contributedBy], [doap:documenter], [doap:maintainer], [doap:helper], [doap:translator]|contributors, contributorsURI, contributorsInstitution, contributorsInstitutionURI|[Sec 3.5.2] **[RECOMMENDED]**|[Text] or [Person] or [BNode]|[ontology](#onto), [config]|
|Creation date|[dcterms:created], [schema:dateCreated], [prov:generatedAtTime], [pav:createdOn], [doap:created]|dateCreated|[Sec 3.4.2] **[OPTIONAL]**|[Text]|[ontology](#onto), [config]|
|Creators|[dcterms:creator], [dc:creator], [schema:creator], [pav:createdBy], [pav:authoredBy], [prov:wasAttributedTo], [doap:developer], [foaf:maker]|authors, authorsURI, authorsInstitution, authorsInstitutionURI|[Sec 3.5.1] **[RECOMMENDED]**|[Text] or [Person] or [BNode]|[ontology](#onto), [config]|
|Contributors|[dcterms:contributor], [dc:contributor], [schema:contributor], [pav:contributedBy], [doap:documenter], [doap:maintainer], [doap:helper], [doap:translator]|contributors, contributorsURI, contributorsInstitution, contributorsInstitutionURI|[Sec 3.5.2] **[RECOMMENDED]**|[Text] or [Person] or [BNode]|[ontology](#onto), [config]|
|Description|[dc:description], [dcterms:description], [schema:description], [rdfs:comment], [skos:note], [doap:description], [doap:shortdesc]|description|[Sec 3.2.3] **[OPTIONAL]**|[Text]|[ontology](#onto), [config]|
|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]|
Expand Down Expand Up @@ -140,6 +141,7 @@ The following `Turtle` code block shows sample annotations for each of the metad
bibo:status <http://purl.org/ontology/bibo/status/draft> ;
foaf:fundedBy <https://example.org/fundingOrganization> ;
schema:funding <https://example.org/fundingGrant> ;
schema:codeRepository "https://github.com/dgarijo/example"^^xsd:anyURI;
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" .
Expand Down Expand Up @@ -218,6 +220,7 @@ authorsInstitution=First author institution;Second author institution
authorsInstitutionURI=https://www.isi.edu/;https://www.isi.edu/
backwardCompatibleWith=https://w3id.org/example/1.0.0
citeAs="add some citattion text here."
codeRepository=https://github.com/dgarijo/example
contributors=First contributor;Second contributor
contributorsURI=http://example.org/contributor1;http://example.org/contributor2
contributorsInstitution=First contributor institution;Second contributor institution
Expand Down Expand Up @@ -316,6 +319,7 @@ TurtleSerialization=ontology.ttl
[Sec 3.8.1]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#logo
[Sec 3.8.2]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#diagram
[Sec 3.9]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#similar
[Sec 3.10]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#code
[Sec 4.1]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#label
[Sec 4.2]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#def
[Sec 4.3]: https://dgarijo.github.io/Widoco/doc/bestPractices/index-en.html#osource
Expand Down Expand Up @@ -358,6 +362,7 @@ TurtleSerialization=ontology.ttl
[doap:maintainer]: http://usefulinc.com/ns/doap#maintainer
[doap:shortdesc]: http://usefulinc.com/ns/doap#shortdesc
[doap:translator]: http://usefulinc.com/ns/doap#translator
[doap:repository]: http://usefulinc.com/ns/doap#repository
[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
Expand Down Expand Up @@ -398,6 +403,7 @@ TurtleSerialization=ontology.ttl
[schema:affiliation]: https://schema.org/affiliation
[schema:citation]: https://schema.org/citation
[schema:contributor]: https://schema.org/contributor
[schema:codeRepository]: https://schema.org/codeRepository
[schema:creator]: https://schema.org/creator
[schema:creativeWorkStatus]: https://schema.org/creativeWorkStatus
[schema:dateCreated]: https://schema.org/dateCreated
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/widoco/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ private void initializeOntology() {
mainOntologyMetadata.setSeeAlso(new ArrayList<>());
mainOntologyMetadata.setFunders(new ArrayList<>());
mainOntologyMetadata.setFundingGrants(new ArrayList<>());
mainOntologyMetadata.setCodeRepository("");
this.namespaceDeclarations = new HashMap<>();
}

Expand Down Expand Up @@ -411,6 +412,7 @@ private void loadPropertyFile(String path) throws IOException {
this.setIntroductionPath(propertyFile.getProperty(Constants.PF_INTRO_PATH, null));
this.setOverviewPath(propertyFile.getProperty(Constants.PF_OVERVIEW_PATH, null));
this.setReferencesPath(propertyFile.getProperty(Constants.PF_REFERENCES_PATH, null));
mainOntologyMetadata.setCodeRepository(propertyFile.getProperty(Constants.PF_REFERENCES_CODE_REPO, ""));
} catch (IOException ex) {
// Only a warning, as we can continue safely without a property file.
logger.warn("Error while reading configuration properties from [" + path + "]: " + ex.getMessage());
Expand Down Expand Up @@ -855,6 +857,12 @@ private void completeOntologyMetadata(OWLAnnotation a, OWLOntology o) {
value = WidocoUtils.getValueAsLiteralOrURI(a.getValue());
mainOntologyMetadata.getSerializations().replace(Constants.TTL, value);
break;
case Constants.PROP_DOAP_REPO:
case Constants.PROP_SCHEMA_CODE_REPO_HTTP:
case Constants.PROP_SCHEMA_CODE_REPO_HTTPS:
value = WidocoUtils.getValueAsLiteralOrURI(a.getValue());
mainOntologyMetadata.setCodeRepository(value);
break;
}
}

Expand Down
19 changes: 18 additions & 1 deletion src/main/java/widoco/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class Constants {
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 NS_DOAP = "http://usefulinc.com/ns/doap#";

public static final String PROP_RDFS_LABEL = NS_RDFS + "label";
public static final String PROP_RDFS_COMMENT = NS_RDFS + "comment";
Expand Down Expand Up @@ -125,6 +126,8 @@ public class Constants {
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_SCHEMA_CODE_REPO_HTTP = NS_SCHEMA_HTTP + "codeRepository";
public static final String PROP_SCHEMA_CODE_REPO_HTTPS = NS_SCHEMA_HTTPS + "codeRepository";

public static final String PROP_OWL_VERSION_INFO = NS_OWL + "versionInfo";
public static final String PROP_OWL_PRIOR_VERSION = NS_OWL + "priorVersion";
Expand Down Expand Up @@ -156,6 +159,8 @@ public class Constants {
public static final String PROP_DCTERMS_HAS_VERSION = NS_DCTERMS + "hasVersion";
public static final String PROP_DCTERMS_SOURCE = NS_DCTERMS + "source";

public static final String PROP_DOAP_REPO = NS_DOAP + "repository";

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

Expand Down Expand Up @@ -278,6 +283,7 @@ public class Constants {
public static final String PF_DESCRIPTION_PATH = "pathToDescription";
public static final String PF_OVERVIEW_PATH = "pathToOverview";
public static final String PF_REFERENCES_PATH = "pathToReferences";
public static final String PF_REFERENCES_CODE_REPO = "codeRepository";

/*OWL_API RDF Serializations*/
public static final String RDF_XML = "RDF/XML";
Expand Down Expand Up @@ -354,6 +360,7 @@ public class Constants {
public static final String LANG_SEE_ALSO = "seeAlso";
public static final String LANG_FUNDER = "funder";
public static final String LANG_FUNDING = "funding";
public static final String LANG_CODE_REPO = "codeRepository";

// labels for the changelog
public static final String LANG_CHANGELOG_HEAD = "changelogHead";
Expand Down Expand Up @@ -680,6 +687,9 @@ public static String getJSONLDSnippet(Configuration c) {
if (o.getLicense() != null && o.getLicense().getUrl() != null && !"".equals(o.getLicense().getUrl())) {
metadata += ", \"license\":\"" + o.getLicense().getUrl() + "\"";
}
if(o.getCodeRepository()!=null && !o.getCodeRepository().isEmpty()){
metadata += ", \"codeRepository\":\"" + o.getCodeRepository() + "\"";
}
// authors (optional)
ArrayList<Agent> a = o.getCreators();
if (!a.isEmpty()) {
Expand Down Expand Up @@ -1088,13 +1098,20 @@ public static String getHeadSection(Configuration c, Properties l) {
+ "<a href=\""+c.getMainOntology().getBackwardsCompatibleWith()+"\">"
+ c.getMainOntology().getBackwardsCompatibleWith() +"</a>" + "</dd>\n";
}
if (!"".equals(c.getMainOntology().getIncompatibleWith())
if (!"".equals(c.getMainOntology().getIncompatibleWith())
&& c.getMainOntology().getIncompatibleWith() != null) {
// doi is common for all languages
head += "<dt>" + l.getProperty(LANG_INCOMPATIBLE) + ":</dt>\n<dd>"
+ "<a href=\""+c.getMainOntology().getIncompatibleWith()+"\">"
+ c.getMainOntology().getIncompatibleWith() +"</a>" + "</dd>\n";
}
if (!"".equals(c.getMainOntology().getCodeRepository())
&& c.getMainOntology().getCodeRepository() != null) {
// doi is common for all languages
head += "<dt>" + l.getProperty(LANG_CODE_REPO) + ":</dt>\n<dd>"
+ "<a href=\""+c.getMainOntology().getCodeRepository()+"\">"
+ c.getMainOntology().getCodeRepository() +"</a>" + "</dd>\n";
}

// end definition list
head += "</dl>\n\n";
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/widoco/entities/Ontology.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ public class Ontology {

private String logo;

private String codeRepository;



public Ontology() {
Expand Down Expand Up @@ -458,4 +460,12 @@ public ArrayList<String> getSources() {
public void setSources(ArrayList<String> sources) {
this.sources = sources;
}

public String getCodeRepository(){
return codeRepository;
}

public void setCodeRepository(String codeRepository) {
this.codeRepository = codeRepository;
}
}
70 changes: 16 additions & 54 deletions src/main/java/widoco/gui/GuiStep2.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,58 +210,58 @@ private void refreshTable() {
}
}
for (Agent a : conf.getMainOntology().getContributors()) {
if (a.getName() == null || a.getName().equals("")) {
if (a.getName() == null || a.getName().isEmpty()) {
contributors.append("contributor; ");
} else {
contributors.append(a.getName()).append("; ");
}
}
for (Agent a : conf.getMainOntology().getFunders()) {
if (a.getName() == null || a.getName().equals("")) {
if (a.getName() == null || a.getName().isEmpty()) {
funders.append("funding; ");
} else {
funders.append(a.getName()).append("; ");
}
}
for (Ontology a : conf.getMainOntology().getImportedOntologies()) {
if (a.getName() == null || a.getName().equals("")) {
if (a.getName() == null || a.getName().isEmpty()) {
imported.append("importedOnto; ");
} else {
imported.append(a.getName()).append("; ");
}
}
for (Ontology a : conf.getMainOntology().getExtendedOntologies()) {
if (a.getName() == null || a.getName().equals("")) {
if (a.getName() == null || a.getName().isEmpty()) {
extended.append("extendedOnto; ");
} else {
extended.append(a.getName()).append("; ");
}
}
Agent p = conf.getMainOntology().getPublisher();
if (p.getName() == null || p.getName().equals("")) {
if (p.getName() == null || p.getName().isEmpty()) {
if (p.getURL() != null) {
publisher.append("publisherName ");
}
} else {
publisher.append(p.getName());
}
for (String img: conf.getMainOntology().getImages()){
if(!img.equals("")){
if(!img.isEmpty()){
images.append(img).append(";");
}
}
for (String source: conf.getMainOntology().getSources()){
if(!source.equals("")){
if(!source.isEmpty()){
sources.append(source).append(";");
}
}
for (String see: conf.getMainOntology().getSeeAlso()){
if(!see.equals("")){
if(!see.isEmpty()){
seeAlso.append(see).append(";");
}
}
for (String see: conf.getMainOntology().getFundingGrants()){
if(!see.equals("")){
if(!see.isEmpty()){
funding.append(see).append(";");
}
}
Expand Down Expand Up @@ -295,11 +295,12 @@ private void refreshTable() {
{ "logo", conf.getMainOntology().getLogo() },
{ "sources", sources.toString() },
{ "funding", funding.toString() },
{ "see also", seeAlso.toString() }
{ "see also", seeAlso.toString() },
{ "code repository", conf.getMainOntology().getCodeRepository() }
},
new String[] { "Property", "Value" }) {
Class[] types = new Class[] { java.lang.String.class, java.lang.Object.class };
boolean[] canEdit = new boolean[] { false, true };
final Class[] types = new Class[] { java.lang.String.class, java.lang.Object.class };
final boolean[] canEdit = new boolean[] { false, true };

@Override
public Class getColumnClass(int columnIndex) {
Expand Down Expand Up @@ -402,6 +403,9 @@ private void saveMetadata() {
case "logo":
conf.getMainOntology().setLogo(value);
break;
case "code repository":
conf.getMainOntology().setCodeRepository(value);
break;
}
}
}
Expand Down Expand Up @@ -913,47 +917,6 @@ private void checkListLabelMouseExited(java.awt.event.MouseEvent evt) {// GEN-FI
* @param args
* the command line arguments
*/
// public static void main(String args[]) {
// /* Set the Nimbus look and feel */
// //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
// (optional) ">
// /* If Nimbus (introduced in Java SE 6) is not available, stay with the
// default look and feel.
// * For details see
// http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
// */
// try {
// for (javax.swing.UIManager.LookAndFeelInfo info :
// javax.swing.UIManager.getInstalledLookAndFeels()) {
// if ("Nimbus".equals(info.getName())) {
// javax.swing.UIManager.setLookAndFeel(info.getClassName());
// break;
// }
// }
// } catch (ClassNotFoundException ex) {
// java.util.logging.Logger.getLogger(GuiStep2.class.getName()).log(java.util.logging.Level.SEVERE,
// null, ex);
// } catch (InstantiationException ex) {
// java.util.logging.Logger.getLogger(GuiStep2.class.getName()).log(java.util.logging.Level.SEVERE,
// null, ex);
// } catch (IllegalAccessException ex) {
// java.util.logging.Logger.getLogger(GuiStep2.class.getName()).log(java.util.logging.Level.SEVERE,
// null, ex);
// } catch (javax.swing.UnsupportedLookAndFeelException ex) {
// java.util.logging.Logger.getLogger(GuiStep2.class.getName()).log(java.util.logging.Level.SEVERE,
// null, ex);
// }
// //</editor-fold>
//
// /* Create and display the form */
// java.awt.EventQueue.invokeLater(new Runnable() {
//
// public void run() {
// new GuiStep2().setVisible(true);
// }
// });
// }
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton backButton;
private javax.swing.JProgressBar barStatus;
private javax.swing.JButton cancelButton;
Expand All @@ -980,5 +943,4 @@ private void checkListLabelMouseExited(java.awt.event.MouseEvent evt) {// GEN-FI
private javax.swing.JTextPane textPaneSteps;
private javax.swing.JCheckBox useLicensiusWSCheckBox;
private javax.swing.JLabel widocoLogo;
// End of variables declaration//GEN-END:variables
}
1 change: 1 addition & 0 deletions src/main/resources/widoco/cs.properties
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ source=Zdroj:
seeAlso=Viz tak&eacute;:
funder=Sponzora:
funding=Financov&aacute;n&iacute;:
codeRepository=Slovn&iacute; z&aacute;soba udrzovan&aacute; na
Loading

0 comments on commit a6905c3

Please sign in to comment.