Skip to content

Commit

Permalink
Bug Corrections
Browse files Browse the repository at this point in the history
After last namespace declaration use > instead of /> and at the end of
the file include </rdf:RDF> FIXED
Missing NS:
xmlns:foaf=http://xmlns.com/foaf/0.1/
xmlns:cc="http://creativecommons.org/ns#"    FIXED
xmlns:vann="http://purl.org/vocab/vann/"
I would recommend to include EOL and classic XML indentation to allow
reading the actual output file in text reader  WORKING WITH OWL API
Use the .rdf extension for your file, it’s preferred.  FIXED
You should better use rdf:about rather than rdf:ID … my mistake
actually. Check
https://www.ibm.com/developerworks/library/x-tiprdfai/index.html for
tips on how to declare base NS accordingly  FIXED 
prefLabels and hiddenLabels are currently defined after the skos:Concept
FIXED
Of course change skos:inScheme as per GitHub issue #4 WAITING FOR URIs
  • Loading branch information
Elcio committed Oct 26, 2017
1 parent c018fb3 commit ad566fc
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 41 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sourceforge.owlapi/owlapi-distribution -->
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-distribution</artifactId>
<version>5.1.2</version>
</dependency>


</dependencies>

Expand Down
86 changes: 45 additions & 41 deletions src/main/java/cladimed2skos/CladimedConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public class CladimedConverter {

public static final String SKOS_COMCEPT_CLOSE="</skos:Concept>";

public static final String RDF_CLOSE="</rdf:RDF>";



// conditionals

Expand All @@ -63,7 +66,8 @@ public class CladimedConverter {
public static final String ABANDON2016 = "Abandon décembre 2016";
public static final String MODIFIED2016 = "Modification dénomination décembre 2016";
public static final String MODIFIEDAT = "2016-12-31";

public static final String DOCTODATE2016 = "2016";
public static final String DOCTODATE2017 = "2017";

public static final String OWL_DEPRECATED = "<owl:deprecated rdf:resource=\"http://www.w3.org/2002/07/owl#deprecated\">true</owl:deprecated>";

Expand Down Expand Up @@ -423,7 +427,7 @@ private void processSingleDestinationFile(){


// Generate FILE
String filePath = destinationFolder+"/cladimed_classif_simple_and_complete_skos.txt";
String filePath = destinationFolder+"/cladimed.rdf";
String headerFilePath = destinationFolder+"/cladimed_header_metadata.txt";
System.out.println("File: "+ filePath);
File file = new File(filePath);
Expand Down Expand Up @@ -453,28 +457,12 @@ private void processSingleDestinationFile(){
item = entry.getValue();
if(item.getErrorDescription().isEmpty()){
line = SKOS_COMCEPT_OPEN_PRE + item.getCode()+SKOS_COMCEPT_OPEN_POS;
line += SKOS_NOTATION_OPEN + item.getCode()+ SKOS_NOTATION_CLOSE;
line += SKOS_DCT_OPEN + "2016" + SKOS_DCT_CLOSE;
line += SKOS_CLASSIF_SIMPLE;
// variable part
if(item.getSf().isEmpty()){
line += SKOS_TOP_CONCEPT_OF_SIMPLE;
}else{
line += SKOS_BROADER_OPEN + item.getBroaderConcept()+SKOS_BROADER_CLOSE;
}
if(item.getNarrowerConcepts().size()>0){
for(String narrower: item.getNarrowerConcepts()){
line += SKOS_NARROWER_OPEN + narrower + SKOS_NARROWER_CLOSE;
}
}
line += SKOS_COMCEPT_CLOSE;
// Issue 2 for abandon on LABEL
if(item.getLabel().toUpperCase().indexOf("ABAN")>-1 && item.getObs1().isEmpty()){
line += OWL_DEPRECATED;
line += SKOS_CHANGE_NOTE_OPEN+item.getLabel()+SKOS_CHANGE_NOTE_CLOSE;
line += SKOS_PREF_LABEL_OPEN + item.getCode().toLowerCase()+SKOS_PREF_LABEL_CLOSE;
line += SKOS_HIDDEN_LABEL_OPEN + item.getCode().toUpperCase()+SKOS_HIDDEN_LABEL_CLOSE;

line += OWL_DEPRECATED;
line += SKOS_CHANGE_NOTE_OPEN+item.getLabel()+SKOS_CHANGE_NOTE_CLOSE;
}else{
line += SKOS_PREF_LABEL_OPEN + item.getLabel().toLowerCase()+SKOS_PREF_LABEL_CLOSE;
line += SKOS_HIDDEN_LABEL_OPEN + item.getLabel().toUpperCase()+SKOS_HIDDEN_LABEL_CLOSE;
Expand All @@ -485,7 +473,22 @@ private void processSingleDestinationFile(){
}
}
// END issue 2

line += SKOS_NOTATION_OPEN + item.getCode()+ SKOS_NOTATION_CLOSE;
line += SKOS_DCT_OPEN + DOCTODATE2016 + SKOS_DCT_CLOSE;
line += SKOS_CLASSIF_SIMPLE;
// variable part
if(item.getSf().isEmpty()){
line += SKOS_TOP_CONCEPT_OF_SIMPLE;
}else{
line += SKOS_BROADER_OPEN + item.getBroaderConcept()+SKOS_BROADER_CLOSE;
}
if(item.getNarrowerConcepts().size()>0){
for(String narrower: item.getNarrowerConcepts()){
line += SKOS_NARROWER_OPEN + narrower + SKOS_NARROWER_CLOSE;
}
}
line += SKOS_COMCEPT_CLOSE;


out.write(line);
out.newLine();
Expand All @@ -500,12 +503,28 @@ private void processSingleDestinationFile(){
item = entry.getValue();
if(item.getErrorDescription().isEmpty()){
line = SKOS_COMCEPT_OPEN_PRE + item.getCode()+SKOS_COMCEPT_OPEN_POS;
// Issue 2 for abandon on LABEL
if(item.getLabel().toUpperCase().indexOf("ABAN")>-1 && item.getObs1().isEmpty()){
line += SKOS_PREF_LABEL_OPEN + item.getCode().toLowerCase()+SKOS_PREF_LABEL_CLOSE;
line += SKOS_HIDDEN_LABEL_OPEN + item.getCode().toUpperCase()+SKOS_HIDDEN_LABEL_CLOSE;
line += OWL_DEPRECATED;
line += SKOS_CHANGE_NOTE_OPEN+item.getLabel()+SKOS_CHANGE_NOTE_CLOSE;
}else{
line += SKOS_PREF_LABEL_OPEN + item.getLabel().toLowerCase()+SKOS_PREF_LABEL_CLOSE;
line += SKOS_HIDDEN_LABEL_OPEN + item.getLabel().toUpperCase()+SKOS_HIDDEN_LABEL_CLOSE;
}
if(item.getLabel().toUpperCase().indexOf("ABAN")>-1 && !item.getObs1().isEmpty()){
if(item.getObs1().equalsIgnoreCase(ABANDON2016)){
line += PROV_INVALIDATED_AT_OPEN+MODIFIEDAT+PROV_INVALIDATED_AT_CLOSE;
}
}
// END issue 2
line += SKOS_NOTATION_OPEN + item.getCode()+ SKOS_NOTATION_CLOSE;
line += SKOS_DCT_OPEN;
if(item.getObs1().equalsIgnoreCase(NEW2017)){
line += "2017";
line += DOCTODATE2017;
}else{
line += "2016";
line += DOCTODATE2016;
}
line +=SKOS_DCT_CLOSE;
// lines below commented due the issue 2
Expand Down Expand Up @@ -536,32 +555,17 @@ private void processSingleDestinationFile(){

}
line += SKOS_COMCEPT_CLOSE;
// Issue 2 for abandon on LABEL
if(item.getLabel().toUpperCase().indexOf("ABAN")>-1 && item.getObs1().isEmpty()){
line += OWL_DEPRECATED;
line += SKOS_CHANGE_NOTE_OPEN+item.getLabel()+SKOS_CHANGE_NOTE_CLOSE;
line += SKOS_PREF_LABEL_OPEN + item.getCode().toLowerCase()+SKOS_PREF_LABEL_CLOSE;
line += SKOS_HIDDEN_LABEL_OPEN + item.getCode().toUpperCase()+SKOS_HIDDEN_LABEL_CLOSE;

}else{
line += SKOS_PREF_LABEL_OPEN + item.getLabel().toLowerCase()+SKOS_PREF_LABEL_CLOSE;
line += SKOS_HIDDEN_LABEL_OPEN + item.getLabel().toUpperCase()+SKOS_HIDDEN_LABEL_CLOSE;
}
if(item.getLabel().toUpperCase().indexOf("ABAN")>-1 && !item.getObs1().isEmpty()){
if(item.getObs1().equalsIgnoreCase(ABANDON2016)){
line += PROV_INVALIDATED_AT_OPEN+MODIFIEDAT+PROV_INVALIDATED_AT_CLOSE;
}
}
// END issue 2

out.write(line);
out.newLine();
size++;

}
}


// close file
line = RDF_CLOSE;
out.write(line);
out.close();
}catch(IOException e){
e.printStackTrace();
Expand Down

0 comments on commit ad566fc

Please sign in to comment.