use of mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote in project opentheso by miledrousset.
the class WriteSkosBDD method addNotes.
public ArrayList<NodeNote> addNotes(ArrayList<SKOSDocumentation> documentationsList) {
ArrayList<NodeNote> nodeNotes = new ArrayList<>();
for (int i = 0; i < documentationsList.size(); i++) {
SKOSDocumentation documentation = documentationsList.get(i);
switch(documentation.getProperty()) {
case SKOSProperty.scopeNote:
NodeNote nodeNote = new NodeNote();
nodeNote.setLang(documentation.getLanguage());
nodeNote.setLexicalvalue(documentation.getText());
nodeNote.setNotetypecode("scopeNote");
nodeNotes.add(nodeNote);
break;
case SKOSProperty.historyNote:
NodeNote nodeNote2 = new NodeNote();
nodeNote2.setLang(documentation.getLanguage());
nodeNote2.setLexicalvalue(documentation.getText());
nodeNote2.setNotetypecode("historyNote");
nodeNotes.add(nodeNote2);
break;
case SKOSProperty.definition:
NodeNote nodeNote3 = new NodeNote();
nodeNote3.setLang(documentation.getLanguage());
nodeNote3.setLexicalvalue(documentation.getText());
nodeNote3.setNotetypecode("definition");
nodeNotes.add(nodeNote3);
break;
case SKOSProperty.editorialNote:
NodeNote nodeNote4 = new NodeNote();
nodeNote4.setLang(documentation.getLanguage());
nodeNote4.setLexicalvalue(documentation.getText());
nodeNote4.setNotetypecode("editorialNote");
nodeNotes.add(nodeNote4);
break;
case SKOSProperty.note:
NodeNote nodeNote5 = new NodeNote();
nodeNote5.setLang(documentation.getLanguage());
nodeNote5.setLexicalvalue(documentation.getText());
nodeNote5.setNotetypecode("note");
nodeNotes.add(nodeNote5);
break;
default:
break;
}
}
return nodeNotes;
}
use of mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote in project opentheso by miledrousset.
the class ImportRdf4jHelper method addDocumentation.
private void addDocumentation(AddConceptsStruct acs) {
NodeNote nodeNote;
for (SKOSDocumentation documentation : acs.conceptResource.getDocumentationsList()) {
String noteTypeCode = "";
int prop = documentation.getProperty();
nodeNote = new NodeNote();
switch(prop) {
case SKOSProperty.definition:
noteTypeCode = "definition";
break;
case SKOSProperty.scopeNote:
noteTypeCode = "scopeNote";
break;
case SKOSProperty.example:
noteTypeCode = "example";
break;
case SKOSProperty.historyNote:
noteTypeCode = "historyNote";
break;
case SKOSProperty.editorialNote:
noteTypeCode = "editorialNote";
break;
case SKOSProperty.changeNote:
noteTypeCode = "changeNote";
break;
case SKOSProperty.note:
noteTypeCode = "note";
break;
}
nodeNote.setLang(documentation.getLanguage());
nodeNote.setLexicalvalue(documentation.getText());
nodeNote.setNotetypecode(noteTypeCode);
acs.nodeNotes.add(nodeNote);
}
}
use of mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote in project opentheso by miledrousset.
the class GetAltLabelTest method testExportAllDatas.
/**
* Test of Get datas for SiteMap.
*/
@org.junit.Test
public void testExportAllDatas() {
HikariDataSource conn = openConnexionPool();
String idTheso = "TH_1";
String idLang = "fr";
String idGroup = "6";
boolean passed = false;
// ConceptHelper conceptHelper = new ConceptHelper();
TermHelper termHelper = new TermHelper();
NoteHelper noteHelper = new NoteHelper();
// ArrayList<NodeConceptArkId> allIds = conceptHelper.getAllConceptArkIdOfThesaurus(conn, idTheso);
StringBuilder file = new StringBuilder();
ArrayList<NodeEM> nodeEMs;
ArrayList<NodeTab2Levels> nodeConceptTermId = termHelper.getAllIdOfNonPreferredTermsByGroup(conn, idTheso, idGroup);
Term term;
ArrayList<NodeNote> nodeNotes;
file.append("Id_concept");
file.append("\t");
file.append("prefLabel");
file.append("\t");
file.append("altLabel");
file.append("\t");
file.append("définition");
file.append("\n");
for (NodeTab2Levels nodeTab2Levels : nodeConceptTermId) {
nodeEMs = termHelper.getNonPreferredTerms(conn, nodeTab2Levels.getIdTerm(), idTheso, idLang);
if (!nodeEMs.isEmpty()) {
term = termHelper.getThisTerm(conn, nodeTab2Levels.getIdConcept(), idTheso, idLang);
nodeNotes = noteHelper.getListNotesTerm(conn, nodeTab2Levels.getIdTerm(), idTheso, idLang);
// écriture dans le fichier
file.append(nodeTab2Levels.getIdConcept());
file.append("\t");
file.append(term.getLexical_value());
file.append("\t");
for (NodeEM nodeEM : nodeEMs) {
if (passed) {
file.append("##");
}
file.append(nodeEM.getLexical_value());
passed = true;
}
file.append("\t");
for (NodeNote nodeNote : nodeNotes) {
if (nodeNote.getNotetypecode().equalsIgnoreCase("definition")) {
file.append(nodeNote.getLexicalvalue());
}
}
file.append("\n");
}
passed = false;
}
System.out.println(file.toString());
conn.close();
}
use of mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote in project opentheso by miledrousset.
the class WriteFileSKOS_Frantiq method writeDescriptor.
/**
* Cette fonction permet d'exporter un Concept au format SKOS,
* Si l'identifiant Ark existe, on l'exporte comme URI, sinon, on utilise l'adresse URI du Site par defaut.
*
* @param nodeConceptExport
*
* @return true ou false
*/
public boolean writeDescriptor(NodeConceptExport nodeConceptExport) {
// getUri(nodeConceptExport));
SKOSResource concept = new SKOSResource(serverAdress + "concept#" + nodeConceptExport.getConcept().getIdConcept());
for (int i = 0; i < nodeConceptExport.getNodeTermTraductions().size(); i++) {
concept.addLabel(nodeConceptExport.getNodeTermTraductions().get(i).getLexicalValue(), nodeConceptExport.getNodeTermTraductions().get(i).getLang(), SKOSProperty.prefLabel);
}
concept.addDate(nodeConceptExport.getConcept().getCreated().toString(), SKOSProperty.created);
concept.addDate(nodeConceptExport.getConcept().getModified().toString(), SKOSProperty.modified);
if (!nodeConceptExport.getConcept().getIdConcept().isEmpty()) {
concept.addIdentifier(nodeConceptExport.getConcept().getIdConcept(), SKOSProperty.identifier);
}
for (int i = 0; i < nodeConceptExport.getNodeListIdsOfConceptGroup().size(); i++) {
concept.addRelation(URI + "concept#" + nodeConceptExport.getNodeListIdsOfConceptGroup().get(i).getIdConcept(), SKOSProperty.inScheme);
/* concept.addRelation(
getRelationUri_inScheme(nodeConceptExport.getNodeListIdsOfConceptGroup().get(i),
nodeConceptExport.getConcept().getIdThesaurus()),
SKOSProperty.inScheme);*/
}
for (int i = 0; i < nodeConceptExport.getNodeListOfBT().size(); i++) {
concept.addRelation(URI + "concept#" + nodeConceptExport.getNodeListOfBT().get(i).getUri().getIdConcept(), SKOSProperty.broader);
/* concept.addRelation(
getRelationUri(nodeConceptExport.getNodeListIdsOfBT().get(i),
nodeConceptExport.getConcept().getIdThesaurus()),
SKOSProperty.broader);
*/
}
for (int i = 0; i < nodeConceptExport.getNodeListOfNT().size(); i++) {
concept.addRelation(URI + "concept#" + nodeConceptExport.getNodeListOfNT().get(i).getUri().getIdConcept(), SKOSProperty.narrower);
/* concept.addRelation(
getRelationUri(nodeConceptExport.getNodeListIdsOfNT().get(i),
nodeConceptExport.getConcept().getIdThesaurus()),
SKOSProperty.narrower);
*/
}
for (int i = 0; i < nodeConceptExport.getNodeListIdsOfRT().size(); i++) {
concept.addRelation(URI + "concept#" + nodeConceptExport.getNodeListIdsOfRT().get(i).getUri().getIdConcept(), SKOSProperty.related);
/* concept.addRelation(
getRelationUri(nodeConceptExport.getNodeListIdsOfRT().get(i),
nodeConceptExport.getConcept().getIdThesaurus()),
SKOSProperty.related);
*/
}
for (int i = 0; i < nodeConceptExport.getNodeEM().size(); i++) {
if (nodeConceptExport.getNodeEM().get(i).isHiden()) {
concept.addLabel(nodeConceptExport.getNodeEM().get(i).getLexical_value(), nodeConceptExport.getNodeEM().get(i).getLang(), SKOSProperty.hiddenLabel);
} else {
concept.addLabel(nodeConceptExport.getNodeEM().get(i).getLexical_value(), nodeConceptExport.getNodeEM().get(i).getLang(), SKOSProperty.altLabel);
}
}
for (NodeAlignment alignment : nodeConceptExport.getNodeAlignmentsList()) {
// alignement exactMatch
if (alignment.getAlignement_id_type() == 1) {
concept.addMapping(alignment.getUri_target().trim(), SKOSMapping.exactMatch);
}
// alignement closeMatch
if (alignment.getAlignement_id_type() == 2) {
concept.addMapping(alignment.getUri_target().trim(), SKOSMapping.closeMatch);
}
}
for (NodeNote nodeNote : nodeConceptExport.getNodeNoteTerm()) {
if (nodeNote.getNotetypecode().equalsIgnoreCase("scopeNote")) {
concept.addDocumentation(nodeNote.getLexicalvalue(), nodeNote.getLang(), SKOSProperty.scopeNote);
}
if (nodeNote.getNotetypecode().equalsIgnoreCase("historyNote")) {
concept.addDocumentation(nodeNote.getLexicalvalue(), nodeNote.getLang(), SKOSProperty.historyNote);
}
if (nodeNote.getNotetypecode().equalsIgnoreCase("editorialNote")) {
concept.addDocumentation(nodeNote.getLexicalvalue(), nodeNote.getLang(), SKOSProperty.editorialNote);
}
if (nodeNote.getNotetypecode().equalsIgnoreCase("definition")) {
concept.addDocumentation(nodeNote.getLexicalvalue(), nodeNote.getLang(), SKOSProperty.definition);
}
}
skosBuff.append(" ").append(concept.toString());
return true;
}
Aggregations