use of mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction in project opentheso by miledrousset.
the class ExportRdf4jHelper method writeConceptInfo.
private void writeConceptInfo(ConceptHelper conceptHelper, SKOSResource sKOSResource, String idThesaurus, String idOfConceptChildren) {
NodeConceptExport nodeConcept = conceptHelper.getConceptForExport(ds, idOfConceptChildren, idThesaurus, false);
if (nodeConcept == null) {
return;
}
sKOSResource.setUri(getUri(nodeConcept));
sKOSResource.setProperty(SKOSProperty.Concept);
// prefLabel
for (NodeTermTraduction traduction : nodeConcept.getNodeTermTraductions()) {
sKOSResource.addLabel(traduction.getLexicalValue(), traduction.getLang(), SKOSProperty.prefLabel);
}
// altLabel
for (NodeEM nodeEM : nodeConcept.getNodeEM()) {
sKOSResource.addLabel(nodeEM.getLexical_value(), nodeEM.getLang(), SKOSProperty.altLabel);
}
ArrayList<NodeNote> nodeNotes = nodeConcept.getNodeNoteConcept();
nodeNotes.addAll(nodeConcept.getNodeNoteTerm());
addNoteGiven(nodeNotes, sKOSResource);
addGPSGiven(nodeConcept.getNodeGps(), sKOSResource);
addAlignementGiven(nodeConcept.getNodeAlignmentsList(), sKOSResource);
addRelationGiven(nodeConcept.getNodeListOfBT(), nodeConcept.getNodeListOfNT(), nodeConcept.getNodeListIdsOfRT(), sKOSResource, nodeConcept.getConcept().getIdThesaurus());
String notation = nodeConcept.getConcept().getNotation();
String created = nodeConcept.getConcept().getCreated().toString();
String modified = nodeConcept.getConcept().getModified().toString();
if (notation != null && !notation.equals("null")) {
sKOSResource.addNotation(notation);
}
if (created != null) {
sKOSResource.addDate(created, SKOSProperty.created);
}
if (modified != null) {
sKOSResource.addDate(modified, SKOSProperty.modified);
}
sKOSResource.addRelation(getUriFromId(idTheso), SKOSProperty.inScheme);
sKOSResource.addIdentifier(nodeConcept.getConcept().getIdConcept(), SKOSProperty.identifier);
skosXmlDocument.addconcept(sKOSResource);
}
use of mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction in project opentheso by miledrousset.
the class ExportRdf4jHelper method addSignleConcept.
public void addSignleConcept(String idThesaurus, String idConcept) {
idTheso = idThesaurus;
ConceptHelper conceptHelper = new ConceptHelper();
SKOSResource sKOSResource = new SKOSResource();
NodeConceptExport nodeConcept = conceptHelper.getConceptForExport(ds, idConcept, idThesaurus, false);
if (nodeConcept == null) {
return;
}
// concept.setUri(getUriFromId(idConcept));
sKOSResource.setUri(getUri(nodeConcept));
sKOSResource.setProperty(SKOSProperty.Concept);
// prefLabel
for (NodeTermTraduction traduction : nodeConcept.getNodeTermTraductions()) {
sKOSResource.addLabel(traduction.getLexicalValue(), traduction.getLang(), SKOSProperty.prefLabel);
}
// altLabel
for (NodeEM nodeEM : nodeConcept.getNodeEM()) {
sKOSResource.addLabel(nodeEM.getLexical_value(), nodeEM.getLang(), SKOSProperty.altLabel);
}
ArrayList<NodeNote> nodeNotes = nodeConcept.getNodeNoteConcept();
nodeNotes.addAll(nodeConcept.getNodeNoteTerm());
addNoteGiven(nodeNotes, sKOSResource);
addGPSGiven(nodeConcept.getNodeGps(), sKOSResource);
addAlignementGiven(nodeConcept.getNodeAlignmentsList(), sKOSResource);
addRelationGiven(nodeConcept.getNodeListOfBT(), nodeConcept.getNodeListOfNT(), nodeConcept.getNodeListIdsOfRT(), sKOSResource, nodeConcept.getConcept().getIdThesaurus());
String notation = nodeConcept.getConcept().getNotation();
String created = nodeConcept.getConcept().getCreated().toString();
String modified = nodeConcept.getConcept().getModified().toString();
if (notation != null && !notation.equals("null")) {
sKOSResource.addNotation(notation);
}
if (created != null) {
sKOSResource.addDate(created, SKOSProperty.created);
}
if (modified != null) {
sKOSResource.addDate(modified, SKOSProperty.modified);
}
sKOSResource.addRelation(getUriFromId(idTheso), SKOSProperty.inScheme);
sKOSResource.addIdentifier(idConcept, SKOSProperty.identifier);
skosXmlDocument.addconcept(sKOSResource);
}
use of mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction in project opentheso by miledrousset.
the class ImportSkosHelper method addConcepts.
/**
* récupération des concepts
* @return
*/
public boolean addConcepts() {
String uri;
Value value;
boolean isTopConcept = true;
Concept concept = new Concept();
ConceptHelper conceptHelper = new ConceptHelper();
TermHelper termHelper = new TermHelper();
NoteHelper noteHelper = new NoteHelper();
Term term = new Term();
AlignmentHelper alignmentHelper = new AlignmentHelper();
// pour intégrer les coordonnées GPS
NodeGps nodeGps = new NodeGps();
GpsHelper gpsHelper = new GpsHelper();
// ajout des termes et traductions
NodeTerm nodeTerm = new NodeTerm();
ArrayList<NodeTermTraduction> nodeTermTraductionList = new ArrayList<>();
// Enregister les synonymes et traductions
ArrayList<NodeEM> nodeEMList = new ArrayList<>();
// ajout des notes
ArrayList<NodeNote> nodeNotes = new ArrayList<>();
// ajout des alignements
ArrayList<NodeAlignment> nodeAlignments = new ArrayList<>();
// ajout des relations
ArrayList<HierarchicalRelationship> hierarchicalRelationships = new ArrayList<>();
// ajout des relations Groups
ArrayList<String> idGrps = new ArrayList<>();
if (dataSet.getSKOSConcepts().isEmpty())
return false;
conceptsCount = dataSet.getSKOSConcepts().size();
// i can get all the concepts from this scheme
for (SKOSConcept skosConcept : dataSet.getSKOSConcepts()) {
// URI du Concept récupération automatique de l'identifiant
String id = getIdFromUri(skosConcept.getURI().toString());
if (id == null || id.isEmpty()) {
message = message + "identifiant null pour l'URI : " + skosConcept.getURI().toString();
continue;
} else {
concept.setIdConcept(id);
}
concept.setIdThesaurus(thesaurus.getId_thesaurus());
// concept.setIdGroup(idGroup.get(0));
concept.setNotation("");
// skos:notation
/* if(anno.getURI().getFragment().equalsIgnoreCase("notation")) {
value = getValue(anno);
NodeTermTraduction nodeTermTraduction = new NodeTermTraduction();
nodeTermTraduction.setLexicalValue(value.getValue());
nodeTermTraduction.setLang(value.getLang());
nodeTermTraductionList.add(nodeTermTraduction);
}*/
concept.setStatus("");
concept.setIdArk(skosConcept.getURI().toString());
for (SKOSAnnotation anno : skosConcept.getSKOSAnnotations(dataSet)) {
// c'est une valeur
if (anno.isAnnotationByConstant()) {
// balises SKOS
if (anno.getURI().getFragment() != null) {
// get notation
if (anno.getURI().getFragment().equalsIgnoreCase("notation")) {
value = getValue(anno);
concept.setNotation(value.getValue());
}
// get GPS : long and lat
if (anno.getURI().getFragment().equalsIgnoreCase("long")) {
value = getValue(anno);
nodeGps.setLongitude(Double.parseDouble(value.getValue()));
}
if (anno.getURI().getFragment().equalsIgnoreCase("lat")) {
value = getValue(anno);
nodeGps.setLatitude(Double.parseDouble(value.getValue()));
}
// get altLabels
if (anno.getURI().getFragment().equalsIgnoreCase("prefLabel")) {
value = getValue(anno);
NodeTermTraduction nodeTermTraduction = new NodeTermTraduction();
nodeTermTraduction.setLexicalValue(value.getValue());
nodeTermTraduction.setLang(value.getLang());
nodeTermTraductionList.add(nodeTermTraduction);
}
if (anno.getURI().getFragment().equalsIgnoreCase("altLabel")) {
value = getValue(anno);
NodeEM nodeEM = new NodeEM();
nodeEM.setLexical_value(value.getValue());
nodeEM.setLang(value.getLang());
nodeEM.setSource("" + idUser);
nodeEM.setStatus("USE");
nodeEM.setHiden(false);
nodeEMList.add(nodeEM);
}
if (anno.getURI().getFragment().equalsIgnoreCase("hiddenLabel")) {
value = getValue(anno);
NodeEM nodeEM = new NodeEM();
nodeEM.setLexical_value(value.getValue());
nodeEM.setLang(value.getLang());
nodeEM.setSource("" + idUser);
nodeEM.setStatus("Hidden");
nodeEM.setHiden(true);
nodeEMList.add(nodeEM);
}
// get notes
if (anno.getURI().getFragment().equalsIgnoreCase("definition")) {
value = getValue(anno);
NodeNote nodeNote = new NodeNote();
nodeNote.setLang(value.getLang());
nodeNote.setLexicalvalue(value.getValue());
nodeNote.setNotetypecode("definition");
nodeNotes.add(nodeNote);
}
if (anno.getURI().getFragment().equalsIgnoreCase("note")) {
value = getValue(anno);
NodeNote nodeNote = new NodeNote();
nodeNote.setLang(value.getLang());
nodeNote.setLexicalvalue(value.getValue());
nodeNote.setNotetypecode("note");
nodeNotes.add(nodeNote);
}
if (anno.getURI().getFragment().equalsIgnoreCase("scopeNote")) {
value = getValue(anno);
NodeNote nodeNote = new NodeNote();
nodeNote.setLang(value.getLang());
nodeNote.setLexicalvalue(value.getValue());
nodeNote.setNotetypecode("scopeNote");
nodeNotes.add(nodeNote);
}
if (anno.getURI().getFragment().equalsIgnoreCase("editorialNote")) {
value = getValue(anno);
NodeNote nodeNote = new NodeNote();
nodeNote.setLang(value.getLang());
nodeNote.setLexicalvalue(value.getValue());
nodeNote.setNotetypecode("editorialNote");
nodeNotes.add(nodeNote);
}
if (anno.getURI().getFragment().equalsIgnoreCase("historyNote")) {
value = getValue(anno);
NodeNote nodeNote = new NodeNote();
nodeNote.setLang(value.getLang());
nodeNote.setLexicalvalue(value.getValue());
nodeNote.setNotetypecode("historyNote");
nodeNotes.add(nodeNote);
}
} else // balises DublinCore dc
{
uri = getIdFromUri(anno.getURI().toString());
if (uri.equalsIgnoreCase("created") || uri.equalsIgnoreCase("date")) {
concept = addDates(concept, formatDate, getValue(anno).getValue(), "created");
}
if (uri.equalsIgnoreCase("modified")) {
concept = addDates(concept, formatDate, getValue(anno).getValue(), "modified");
}
// get the identifier from dcterms ceci peut être aussi l'identifiant ark
if (uri.equalsIgnoreCase("identifier")) {
concept.setIdArk(getValue(anno).getValue());
}
}
} else // c'est une relation
{
// balises SKOS
if (anno.getURI().getFragment() != null) {
// get relations hiérarchiques
if (anno.getURI().getFragment().equalsIgnoreCase("narrower")) {
uri = getIdFromUri(anno.getAnnotationValue().getURI().toString());
HierarchicalRelationship hierarchicalRelationship = new HierarchicalRelationship();
hierarchicalRelationship.setIdConcept1(concept.getIdConcept());
hierarchicalRelationship.setIdConcept2(uri);
hierarchicalRelationship.setIdThesaurus(thesaurus.getId_thesaurus());
hierarchicalRelationship.setRole("NT");
hierarchicalRelationships.add(hierarchicalRelationship);
}
if (anno.getURI().getFragment().equalsIgnoreCase("broader")) {
uri = getIdFromUri(anno.getAnnotationValue().getURI().toString());
HierarchicalRelationship hierarchicalRelationship = new HierarchicalRelationship();
hierarchicalRelationship.setIdConcept1(concept.getIdConcept());
hierarchicalRelationship.setIdConcept2(uri);
hierarchicalRelationship.setIdThesaurus(thesaurus.getId_thesaurus());
hierarchicalRelationship.setRole("BT");
hierarchicalRelationships.add(hierarchicalRelationship);
isTopConcept = false;
}
if (anno.getURI().getFragment().equalsIgnoreCase("related")) {
uri = getIdFromUri(anno.getAnnotationValue().getURI().toString());
HierarchicalRelationship hierarchicalRelationship = new HierarchicalRelationship();
hierarchicalRelationship.setIdConcept1(concept.getIdConcept());
hierarchicalRelationship.setIdConcept2(uri);
hierarchicalRelationship.setIdThesaurus(thesaurus.getId_thesaurus());
hierarchicalRelationship.setRole("RT");
hierarchicalRelationships.add(hierarchicalRelationship);
}
// get scheme
if (anno.getURI().getFragment().equalsIgnoreCase("inScheme")) {
// uri = anno.getAnnotationValue().getURI().toString();
}
// get Groups
if (anno.getURI().getFragment().equalsIgnoreCase("memberOf")) {
uri = getIdFromUri(anno.getAnnotationValue().getURI().toString());
idGrps.add(uri);
addIdGroupToVector(uri);
}
// get Alignements
if (anno.getURI().getFragment().equalsIgnoreCase("closeMatch")) {
uri = anno.getAnnotationValue().getURI().toString();
NodeAlignment nodeAlignment = new NodeAlignment();
nodeAlignment.setId_author(idUser);
nodeAlignment.setConcept_target("");
nodeAlignment.setThesaurus_target("");
nodeAlignment.setUri_target(uri);
nodeAlignment.setInternal_id_concept(concept.getIdConcept());
nodeAlignment.setInternal_id_thesaurus(thesaurus.getId_thesaurus());
nodeAlignment.setAlignement_id_type(2);
nodeAlignments.add(nodeAlignment);
}
if (anno.getURI().getFragment().equalsIgnoreCase("exactMatch")) {
uri = anno.getAnnotationValue().getURI().toString();
NodeAlignment nodeAlignment = new NodeAlignment();
nodeAlignment.setId_author(idUser);
nodeAlignment.setConcept_target("");
nodeAlignment.setThesaurus_target("");
nodeAlignment.setUri_target(uri);
nodeAlignment.setInternal_id_concept(concept.getIdConcept());
nodeAlignment.setInternal_id_thesaurus(thesaurus.getId_thesaurus());
nodeAlignment.setAlignement_id_type(1);
nodeAlignments.add(nodeAlignment);
}
if (anno.getURI().getFragment().equalsIgnoreCase("broadMatch")) {
uri = anno.getAnnotationValue().getURI().toString();
NodeAlignment nodeAlignment = new NodeAlignment();
nodeAlignment.setId_author(idUser);
nodeAlignment.setConcept_target("");
nodeAlignment.setThesaurus_target("");
nodeAlignment.setUri_target(uri);
nodeAlignment.setInternal_id_concept(concept.getIdConcept());
nodeAlignment.setInternal_id_thesaurus(thesaurus.getId_thesaurus());
nodeAlignment.setAlignement_id_type(3);
nodeAlignments.add(nodeAlignment);
}
if (anno.getURI().getFragment().equalsIgnoreCase("narrowMatch")) {
uri = anno.getAnnotationValue().getURI().toString();
NodeAlignment nodeAlignment = new NodeAlignment();
nodeAlignment.setId_author(idUser);
nodeAlignment.setConcept_target("");
nodeAlignment.setThesaurus_target("");
nodeAlignment.setUri_target(uri);
nodeAlignment.setInternal_id_concept(concept.getIdConcept());
nodeAlignment.setInternal_id_thesaurus(thesaurus.getId_thesaurus());
nodeAlignment.setAlignement_id_type(5);
nodeAlignments.add(nodeAlignment);
}
if (anno.getURI().getFragment().equalsIgnoreCase("relatedMatch")) {
uri = anno.getAnnotationValue().getURI().toString();
NodeAlignment nodeAlignment = new NodeAlignment();
nodeAlignment.setId_author(idUser);
nodeAlignment.setConcept_target("");
nodeAlignment.setThesaurus_target("");
nodeAlignment.setUri_target(uri);
nodeAlignment.setInternal_id_concept(concept.getIdConcept());
nodeAlignment.setInternal_id_thesaurus(thesaurus.getId_thesaurus());
nodeAlignment.setAlignement_id_type(4);
nodeAlignments.add(nodeAlignment);
}
}
}
}
// ajout des termes et traductions
nodeTerm.setNodeTermTraduction(nodeTermTraductionList);
nodeTerm.setIdTerm(concept.getIdConcept());
nodeTerm.setIdConcept(concept.getIdConcept());
nodeTerm.setIdThesaurus(thesaurus.getId_thesaurus());
nodeTerm.setSource("");
nodeTerm.setStatus("");
nodeTerm.setCreated(concept.getCreated());
nodeTerm.setModified(concept.getModified());
// conctrole si le concept est vide aucun prefLable, on l'ignore
if (!isConceptEmpty(nodeTermTraductionList)) {
if (idGrps.isEmpty()) {
concept.setTopConcept(isTopConcept);
concept.setIdGroup(idGroupDefault);
conceptHelper.insertConceptInTable(ds, concept, idUser);
} else {
for (String idGrp : idGrps) {
concept.setTopConcept(isTopConcept);
concept.setIdGroup(idGrp);
conceptHelper.insertConceptInTable(ds, concept, idUser);
}
}
termHelper.insertTerm(ds, nodeTerm, idUser);
try {
Connection conn = ds.getConnection();
conn.setAutoCommit(false);
for (HierarchicalRelationship hierarchicalRelationship : hierarchicalRelationships) {
conceptHelper.addLinkHierarchicalRelation(conn, hierarchicalRelationship, idUser);
}
conn.commit();
conn.close();
} catch (SQLException ex) {
}
for (NodeNote nodeNoteList1 : nodeNotes) {
if (nodeNoteList1.getNotetypecode().contains("scopeNote")) {
noteHelper.addConceptNote(ds, concept.getIdConcept(), nodeNoteList1.getLang(), thesaurus.getId_thesaurus(), nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
if (nodeNoteList1.getNotetypecode().contains("historyNote")) {
noteHelper.addConceptNote(ds, concept.getIdConcept(), nodeNoteList1.getLang(), thesaurus.getId_thesaurus(), nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
if (nodeNoteList1.getNotetypecode().contains("definition")) {
noteHelper.addTermNote(ds, nodeTerm.getIdTerm(), nodeNoteList1.getLang(), thesaurus.getId_thesaurus(), nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
if (nodeNoteList1.getNotetypecode().contains("editorialNote")) {
noteHelper.addTermNote(ds, nodeTerm.getIdTerm(), nodeNoteList1.getLang(), thesaurus.getId_thesaurus(), nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
if (nodeNoteList1.getNotetypecode().contains("note")) {
noteHelper.addConceptNote(ds, nodeTerm.getIdTerm(), nodeNoteList1.getLang(), thesaurus.getId_thesaurus(), nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
}
for (NodeAlignment nodeAlignment : nodeAlignments) {
alignmentHelper.addNewAlignment(ds, nodeAlignment);
}
for (NodeEM nodeEMList1 : nodeEMList) {
term.setId_concept(concept.getIdConcept());
term.setId_term(nodeTerm.getIdTerm());
term.setLexical_value(nodeEMList1.getLexical_value());
term.setLang(nodeEMList1.getLang());
term.setId_thesaurus(thesaurus.getId_thesaurus());
term.setSource(nodeEMList1.getSource());
term.setStatus(nodeEMList1.getStatus());
termHelper.addNonPreferredTerm(ds, term, idUser);
}
if (nodeGps.getLatitude() != 0.0) {
if (nodeGps.getLongitude() != 0.0) {
// insertion des données GPS
gpsHelper.insertCoordonees(ds, concept.getIdConcept(), thesaurus.getId_thesaurus(), nodeGps.getLatitude(), nodeGps.getLongitude());
}
}
}
// initialisation des variables
concept = new Concept();
term = new Term();
nodeTerm = new NodeTerm();
nodeTermTraductionList = new ArrayList<>();
nodeEMList = new ArrayList<>();
nodeNotes = new ArrayList<>();
nodeAlignments = new ArrayList<>();
hierarchicalRelationships = new ArrayList<>();
idGrps = new ArrayList<>();
isTopConcept = true;
nodeGps = new NodeGps();
}
for (String idTopConcept1 : idTopConcept) {
if (!conceptHelper.setTopConcept(ds, idTopConcept1, thesaurus.getId_thesaurus())) {
// erreur;
}
}
addGroups();
addLangsToThesaurus(ds, thesaurus.getId_thesaurus());
message = message + "\n nombre de Concepts importés : " + conceptsCount;
return true;
}
use of mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction in project opentheso by miledrousset.
the class ExportTabulateHelper method writeConcepts.
private boolean writeConcepts() {
ArrayList<NodeConceptExport> nodeConceptExports = thesaurusDatas.getNodeConceptExports();
boolean first = true;
ArrayList<NodeNote> nodeNoteDefinition = new ArrayList<>();
ArrayList<NodeNote> nodeNoteScope = new ArrayList<>();
ArrayList<NodeNote> nodeNoteHistory = new ArrayList<>();
ArrayList<NodeNote> nodeNoteEditorial = new ArrayList<>();
ArrayList<String> listLangues = new ArrayList<>();
for (NodeLang selectedLanguage : selectedLanguages) {
listLangues.add(selectedLanguage.getCode());
}
for (NodeConceptExport nodeConceptExport : nodeConceptExports) {
nodeNoteDefinition.clear();
nodeNoteScope.clear();
nodeNoteHistory.clear();
nodeNoteEditorial.clear();
// id
tabulateBuff.append(nodeConceptExport.getConcept().getIdConcept());
tabulateBuff.append(";");
// idArk
if (nodeConceptExport.getConcept().getIdArk() == null) {
tabulateBuff.append("");
} else {
tabulateBuff.append(nodeConceptExport.getConcept().getIdArk());
}
tabulateBuff.append(";");
// type
if (nodeConceptExport.getConcept().isTopConcept()) {
tabulateBuff.append("TT");
} else {
tabulateBuff.append("DE");
}
tabulateBuff.append(";");
// preflabel
for (NodeTermTraduction nodeTermTraduction : nodeConceptExport.getNodeTermTraductions()) {
if (listLangues.contains(nodeTermTraduction.getLang())) {
if (!first) {
tabulateBuff.append("##");
}
tabulateBuff.append(nodeTermTraduction.getLexicalValue());
tabulateBuff.append("::");
tabulateBuff.append(nodeTermTraduction.getLang());
first = false;
}
}
tabulateBuff.append(";");
// altLabel
first = true;
for (NodeEM nodeEM : nodeConceptExport.getNodeEM()) {
if (listLangues.contains(nodeEM.getLang())) {
if (!first) {
tabulateBuff.append("##");
}
tabulateBuff.append(nodeEM.getLexical_value());
tabulateBuff.append("::");
tabulateBuff.append(nodeEM.getLang());
first = false;
}
}
tabulateBuff.append(";");
// inScheme
first = true;
for (NodeUri nodeUri : nodeConceptExport.getNodeListIdsOfConceptGroup()) {
if (!first) {
tabulateBuff.append("##");
}
tabulateBuff.append(nodeUri.getIdConcept());
first = false;
}
tabulateBuff.append(";");
// broader
first = true;
for (NodeHieraRelation node : nodeConceptExport.getNodeListOfBT()) {
if (!first) {
tabulateBuff.append("##");
}
tabulateBuff.append(node.getUri().getIdConcept());
first = false;
}
tabulateBuff.append(";");
// narrower
first = true;
for (NodeHieraRelation node : nodeConceptExport.getNodeListOfNT()) {
if (!first) {
tabulateBuff.append("##");
}
tabulateBuff.append(node.getUri().getIdConcept());
first = false;
}
tabulateBuff.append(";");
// related
first = true;
for (NodeHieraRelation nodeUri : nodeConceptExport.getNodeListIdsOfRT()) {
if (!first) {
tabulateBuff.append("##");
}
tabulateBuff.append(nodeUri.getUri().getIdConcept());
first = false;
}
tabulateBuff.append(";");
// alignment
first = true;
for (NodeAlignment nodeAlignment : nodeConceptExport.getNodeAlignmentsList()) {
if (!first) {
tabulateBuff.append("##");
}
if (nodeAlignment.getAlignement_id_type() == 1) {
tabulateBuff.append("exactMatch::");
tabulateBuff.append(nodeAlignment.getUri_target());
}
if (nodeAlignment.getAlignement_id_type() == 2) {
tabulateBuff.append("closeMatch::");
tabulateBuff.append(nodeAlignment.getUri_target());
}
first = false;
}
tabulateBuff.append(";");
// types : definition; editorialNote; historyNote ; scopeNote
for (NodeNote nodeNote : nodeConceptExport.getNodeNoteConcept()) {
nodeNote.setLexicalvalue(nodeNote.getLexicalvalue().replace('\r', ' '));
nodeNote.setLexicalvalue(nodeNote.getLexicalvalue().replace('\n', ' '));
if (nodeNote.getNotetypecode().equalsIgnoreCase("definition")) {
nodeNoteDefinition.add(nodeNote);
}
if (nodeNote.getNotetypecode().equalsIgnoreCase("editorialNote")) {
nodeNoteEditorial.add(nodeNote);
}
if (nodeNote.getNotetypecode().equalsIgnoreCase("historyNote")) {
nodeNoteHistory.add(nodeNote);
}
if (nodeNote.getNotetypecode().equalsIgnoreCase("scopeNote")) {
nodeNoteScope.add(nodeNote);
}
}
// types : definition; editorialNote; historyNote ; scopeNote
for (NodeNote nodeNote : nodeConceptExport.getNodeNoteTerm()) {
nodeNote.setLexicalvalue(nodeNote.getLexicalvalue().replace('\r', ' '));
nodeNote.setLexicalvalue(nodeNote.getLexicalvalue().replace('\n', ' '));
if (nodeNote.getNotetypecode().equalsIgnoreCase("definition")) {
nodeNoteDefinition.add(nodeNote);
}
if (nodeNote.getNotetypecode().equalsIgnoreCase("editorialNote")) {
nodeNoteEditorial.add(nodeNote);
}
if (nodeNote.getNotetypecode().equalsIgnoreCase("historyNote")) {
nodeNoteHistory.add(nodeNote);
}
if (nodeNote.getNotetypecode().equalsIgnoreCase("scopeNote")) {
nodeNoteScope.add(nodeNote);
}
}
// definition
first = true;
for (NodeNote nodeNote : nodeNoteDefinition) {
if (listLangues.contains(nodeNote.getLang())) {
if (!first) {
tabulateBuff.append("##");
}
tabulateBuff.append(nodeNote.getLexicalvalue());
tabulateBuff.append("::");
tabulateBuff.append(nodeNote.getLang());
first = false;
}
}
tabulateBuff.append(";");
// scopeNote
first = true;
for (NodeNote nodeNote : nodeNoteScope) {
if (listLangues.contains(nodeNote.getLang())) {
if (!first) {
tabulateBuff.append("##");
}
tabulateBuff.append(nodeNote.getLexicalvalue());
tabulateBuff.append("::");
tabulateBuff.append(nodeNote.getLang());
first = false;
}
}
tabulateBuff.append(";");
// historyNote
first = true;
for (NodeNote nodeNote : nodeNoteHistory) {
if (listLangues.contains(nodeNote.getLang())) {
if (!first) {
tabulateBuff.append("##");
}
tabulateBuff.append(nodeNote.getLexicalvalue());
tabulateBuff.append("::");
tabulateBuff.append(nodeNote.getLang());
first = false;
}
}
tabulateBuff.append(";");
// editorialNote
first = true;
for (NodeNote nodeNote : nodeNoteEditorial) {
if (listLangues.contains(nodeNote.getLang())) {
if (!first) {
tabulateBuff.append("##");
}
tabulateBuff.append(nodeNote.getLexicalvalue());
tabulateBuff.append("::");
tabulateBuff.append(nodeNote.getLang());
first = false;
}
}
tabulateBuff.append(";");
// dates
tabulateBuff.append(nodeConceptExport.getConcept().getCreated());
tabulateBuff.append(";");
tabulateBuff.append(nodeConceptExport.getConcept().getModified());
tabulateBuff.append("\n");
first = true;
}
return true;
}
use of mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction in project opentheso by miledrousset.
the class ExportTxtHelper method writeConceptsInfo.
/**
* Permet d'écrire les concepts en bouclant par récursivité pour définir les
* niveaux
*
* @return
*/
private void writeConceptsInfo(String idConcept, String indentation) {
ConceptHelper conceptHelper = new ConceptHelper();
NodeConcept nodeConcept = conceptHelper.getConcept(ds, idConcept, idTheso, selectedLang);
StringPlus stringPlus = new StringPlus();
boolean first = true;
if (nodeConcept == null) {
return;
}
// id numérique séquentiel
txtBuff.append(++number);
txtBuff.append("\t");
// Id_concept
txtBuff.append(idConcept);
txtBuff.append("\t");
// on écrit le Term_concept
txtBuff.append(indentation);
if (nodeConcept.getTerm().getLexical_value().isEmpty()) {
txtBuff.append("(");
txtBuff.append(idConcept);
txtBuff.append(")");
} else {
txtBuff.append(nodeConcept.getTerm().getLexical_value());
}
int tot = StringUtils.countMatches(indentation, "\t");
if (tot < indentationConcept) {
addTabulate(indentationConcept - (tot + 1));
}
if (selectedOptions.contains("occ")) {
// on écrit les occurences
txtBuff.append("\t");
txtBuff.append(totalOfNotices(idConcept));
}
first = true;
if (selectedOptions.contains("nt")) {
// on écrit la relation NT
if (!nodeConcept.getNodeNT().isEmpty()) {
txtBuff.append("\t");
for (NodeNT nodeNT : nodeConcept.getNodeNT()) {
if (!first)
txtBuff.append("\t");
// txtBuff.append("NT: ");
txtBuff.append(nodeNT.getTitle());
first = false;
}
}
if (nodeConcept.getNodeNT().size() < indentationNT) {
addTabulate(indentationNT - nodeConcept.getNodeNT().size());
}
}
first = true;
// on écrit la relation UF
if (selectedOptions.contains("uf")) {
if (!nodeConcept.getNodeEM().isEmpty()) {
txtBuff.append("\t");
for (NodeEM nodeEm : nodeConcept.getNodeEM()) {
if (!first)
txtBuff.append("\t");
// txtBuff.append("UF: ");
txtBuff.append(nodeEm.getLexical_value());
first = false;
}
}
if (nodeConcept.getNodeEM().size() < indentationUF) {
addTabulate(indentationUF - nodeConcept.getNodeEM().size());
}
}
first = true;
if (selectedOptions.contains("bt")) {
// on écrit la relation TG
if (!nodeConcept.getNodeBT().isEmpty()) {
txtBuff.append("\t");
for (NodeBT nodeBT : nodeConcept.getNodeBT()) {
if (!first)
txtBuff.append("\t");
// txtBuff.append("BT: ");
txtBuff.append(nodeBT.getTitle());
first = false;
}
}
if (nodeConcept.getNodeBT().size() < indentationBT) {
addTabulate(indentationBT - nodeConcept.getNodeBT().size());
}
}
first = true;
// on écrit la relation RT
if (selectedOptions.contains("rt")) {
if (!nodeConcept.getNodeRT().isEmpty()) {
txtBuff.append("\t");
for (NodeRT nodeRT : nodeConcept.getNodeRT()) {
if (!first)
txtBuff.append("\t");
// txtBuff.append("RT: ");
txtBuff.append(nodeRT.getTitle());
first = false;
}
}
if (nodeConcept.getNodeRT().size() < indentationRT) {
addTabulate(indentationRT - nodeConcept.getNodeRT().size());
}
}
first = true;
// on écrit les Groupes
if (selectedOptions.contains("groups")) {
if (!nodeConcept.getNodeConceptGroup().isEmpty()) {
txtBuff.append("\t");
for (NodeGroup nodeGroup : nodeConcept.getNodeConceptGroup()) {
if (!first)
txtBuff.append("\t");
// txtBuff.append("MT: ");
txtBuff.append(nodeGroup.getLexicalValue());
first = false;
}
}
if (nodeConcept.getNodeConceptGroup().size() < indentationGroups) {
addTabulate(indentationGroups - nodeConcept.getNodeConceptGroup().size());
}
}
first = true;
// on écrit les traductions
if (selectedOptions.contains("traductions")) {
if (!nodeConcept.getNodeTermTraductions().isEmpty()) {
txtBuff.append("\t");
for (NodeTermTraduction nodeTermTraduction : nodeConcept.getNodeTermTraductions()) {
if (!first)
txtBuff.append("\t");
// txtBuff.append("Tr: ");
txtBuff.append(nodeTermTraduction.getLexicalValue());
txtBuff.append("(");
txtBuff.append(nodeTermTraduction.getLang());
txtBuff.append(")");
first = false;
}
}
if (nodeConcept.getNodeTermTraductions().size() < indentationTraductions) {
addTabulate(indentationTraductions - nodeConcept.getNodeTermTraductions().size());
}
}
first = true;
// on écrit les notes de type Term
if (selectedOptions.contains("notes")) {
if ((!nodeConcept.getNodeNotesTerm().isEmpty()) || (!nodeConcept.getNodeNotesConcept().isEmpty())) {
txtBuff.append("\t");
for (NodeNote nodeNote : nodeConcept.getNodeNotesTerm()) {
if (!first)
txtBuff.append("\t");
// txtBuff.append("noteT: ");
txtBuff.append(stringPlus.clearNewLine(nodeNote.getLexicalvalue()));
first = false;
}
for (NodeNote nodeNote : nodeConcept.getNodeNotesConcept()) {
if (!first)
txtBuff.append("\t");
// txtBuff.append("noteC: ");
txtBuff.append(stringPlus.clearNewLine(nodeNote.getLexicalvalue()));
first = false;
}
}
if (nodeConcept.getNodeNotesTerm().size() < indentationNotes) {
addTabulate(indentationNotes - (nodeConcept.getNodeNotesConcept().size() + nodeConcept.getNodeNotesTerm().size()));
}
}
txtBuff.append("\n");
}
Aggregations