use of mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport in project opentheso by miledrousset.
the class ExportFromBDD method exportConcept.
/**
* Fonction permettant d'exporter Un concept
*
* @param ds
* @param idThesaurus
* @param idConcept
* @return Le Skos en String
*/
public StringBuffer exportConcept(HikariDataSource ds, String idThesaurus, String idConcept) {
WriteFileSKOS writeFileSKOS = new WriteFileSKOS();
// inititialisation des URI
writeFileSKOS.setServerArk(serverArk);
writeFileSKOS.setServerAdress(serverAdress);
writeFileSKOS.setNodePreference(nodePreference);
writeFileSKOS.writeHeader();
ConceptHelper conceptHelper = new ConceptHelper();
NodeConceptExport nodeConcept = conceptHelper.getConceptForExport(ds, idConcept, idThesaurus, isArkActive);
if (nodeConcept == null)
return null;
writeFileSKOS.writeDescriptor(nodeConcept, null);
writeFileSKOS.endSkos();
return writeFileSKOS.getSkosBuff();
}
use of mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport in project opentheso by miledrousset.
the class ExportFromBDD method exportMultiConcept.
/**
* Fonction permettant d'exporter un concept ou plusieurs concepts suivant la valeur
*
* @param ds
* @param idThesaurus
* @param value
* @param lang
* @return Le Skos en String
*/
public StringBuffer exportMultiConcept(HikariDataSource ds, String idThesaurus, String value, String lang) {
WriteFileSKOS writeFileSKOS = new WriteFileSKOS();
writeFileSKOS.writeHeader();
// inititialisation des URI
writeFileSKOS.setServerArk(serverArk);
writeFileSKOS.setServerAdress(serverAdress);
writeFileSKOS.setNodePreference(nodePreference);
ConceptHelper conceptHelper = new ConceptHelper();
ArrayList<NodeConceptExport> listNodeConcept = conceptHelper.getMultiConceptForExport(ds, value, idThesaurus, lang, isArkActive);
for (NodeConceptExport nodeConcept : listNodeConcept) {
writeFileSKOS.writeDescriptor(nodeConcept, null);
}
writeFileSKOS.endSkos();
return writeFileSKOS.getSkosBuff();
}
use of mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport in project opentheso by miledrousset.
the class ConceptHelper method getMultiConceptForExport.
/**
* Cette fonction permet de récupérer toutes les informations concernant un
* ou plusieurs Concept par une chaîne de caractère, suivant le thésaurus,
* la langue et le group
*
* @param ds
* @param value
* @param idThesaurus
* @param idGroup
* @param idLang
* @param isArkActif
* @return Objet class NodeConcept
*/
public ArrayList<NodeConceptExport> getMultiConceptForExport(HikariDataSource ds, String value, String idLang, String idGroup, String idThesaurus, boolean isArkActif) {
ArrayList<NodeConceptExport> listNce = new ArrayList<>();
// Récupération des concept
ArrayList<NodeSearch> listRes = new SearchHelper().searchTerm(ds, value, idLang, idThesaurus, idGroup, 1, false);
for (NodeSearch ns : listRes) {
Concept concept = getThisConcept(ds, ns.getIdConcept(), idThesaurus);
NodeConceptExport nce = new NodeConceptExport();
nce.setConcept(concept);
listNce.add(nce);
}
for (NodeConceptExport nce : listNce) {
String idConcept = nce.getConcept().getIdConcept();
RelationsHelper relationsHelper = new RelationsHelper();
// récupération des BT
ArrayList<NodeHieraRelation> nodeListIdOfBT_Ark = relationsHelper.getListBT(ds, idConcept, idThesaurus);
nce.setNodeListOfBT(nodeListIdOfBT_Ark);
// récupération des termes spécifiques
ArrayList<NodeHieraRelation> nodeListIdOfNT_Ark = relationsHelper.getListNT(ds, idConcept, idThesaurus);
nce.setNodeListOfNT(nodeListIdOfNT_Ark);
// récupération des termes associés
ArrayList<NodeHieraRelation> nodeListIdOfRT_Ark = relationsHelper.getListRT(ds, idConcept, idThesaurus);
nce.setNodeListIdsOfRT(nodeListIdOfRT_Ark);
// récupération des Non Prefered Term
nce.setNodeEM(new TermHelper().getAllNonPreferredTerms(ds, new TermHelper().getIdTermOfConcept(ds, idConcept, idThesaurus), idThesaurus));
// récupération des traductions
nce.setNodeTermTraductions(new TermHelper().getAllTraductionsOfConcept(ds, idConcept, idThesaurus));
// récupération des Groupes
ArrayList<NodeUri> nodeListIdsOfConceptGroup_Ark = getListIdArkOfGroup(ds, new GroupHelper().getListIdGroupOfConcept(ds, idThesaurus, idConcept), idThesaurus);
nce.setNodeListIdsOfConceptGroup(nodeListIdsOfConceptGroup_Ark);
// récupération des notes du Terme
String idTerm = new TermHelper().getIdTermOfConcept(ds, idConcept, idThesaurus);
nce.setNodeNoteTerm(new NoteHelper().getListNotesTermAllLang(ds, idTerm, idThesaurus));
// récupération des Notes du Concept
nce.setNodeNoteConcept(new NoteHelper().getListNotesConceptAllLang(ds, idConcept, idThesaurus));
// récupération des Alignements
nce.setNodeAlignmentsList(new AlignmentHelper().getAllAlignmentOfConcept(ds, idConcept, idThesaurus));
}
return listNce;
}
use of mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport in project opentheso by miledrousset.
the class ExportRdf4jHelper method writeConceptInfo.
private void writeConceptInfo(ConceptHelper conceptHelper, SKOSResource sKOSResource, String idThesaurus, String idOfConceptChildren, DownloadBean downloadBean, List<NodeLang> selectedLanguages) {
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()) {
boolean isInselectedLanguages = false;
for (NodeLang nodeLang : selectedLanguages) {
if (nodeLang.getCode().equals(traduction.getLang())) {
isInselectedLanguages = true;
break;
}
}
if (isInselectedLanguages) {
sKOSResource.addLabel(traduction.getLexicalValue(), traduction.getLang(), SKOSProperty.prefLabel);
}
}
// altLabel
for (NodeEM nodeEM : nodeConcept.getNodeEM()) {
boolean isInselectedLanguages = false;
for (NodeLang nodeLang : selectedLanguages) {
if (nodeLang.getCode().equals(nodeEM.getLang())) {
isInselectedLanguages = true;
break;
}
}
if (isInselectedLanguages) {
sKOSResource.addLabel(nodeEM.getLexical_value(), nodeEM.getLang(), SKOSProperty.altLabel);
}
}
ArrayList<NodeNote> nodeNotes = nodeConcept.getNodeNoteConcept();
nodeNotes.addAll(nodeConcept.getNodeNoteTerm());
addNoteGiven(nodeNotes, sKOSResource, selectedLanguages);
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);
downloadBean.setProgress_abs(downloadBean.getProgress_abs() + 1);
double progress = (downloadBean.getProgress_abs() / downloadBean.getSizeOfTheso()) * 100;
if (progress > 100) {
progress = 100;
}
downloadBean.setProgress_per_100((int) progress);
skosXmlDocument.addconcept(sKOSResource);
}
use of mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport in project opentheso by miledrousset.
the class ExportFromBDD method exportAllConceptsAdvanced.
/**
* focntion récursive pour récupérer la branche des
* @param ds
* @param idArk
* @param idThesaurus
* @param writeFileSKOS
*/
/* private void exportAllConceptsArk(HikariDataSource ds,
String idArk, String idThesaurus,
WriteFileSKOS writeFileSKOS) {
ConceptHelper conceptHelper = new ConceptHelper();
ArrayList <String> listIdsOfConceptChildren = conceptHelper.getListChildrenOfConcept(ds, idConcept, idThesaurus);
NodeConceptExport nodeConcept = conceptHelper.getConceptForExport(ds, idConcept, idThesaurus, isArkActive);
/// attention il y a un problème ici, il faut vérifier pourquoi nous avons un Concept Null
if(nodeConcept.getConcept() == null) {
int k = 0;
return;
}
writeFileSKOS.writeDescriptor(nodeConcept, null);
for (String listIdsOfConceptChildren1 : listIdsOfConceptChildren) {
nodeConcept = conceptHelper.getConceptForExport(ds, listIdsOfConceptChildren1, idThesaurus, isArkActive);
if(nodeConcept != null) {
writeFileSKOS.writeDescriptor(nodeConcept, null);
if (!nodeConcept.getNodeListIdsOfNT().isEmpty()) {
for (int j = 0; j < nodeConcept.getNodeListIdsOfNT().size(); j++) {
exportAllConcepts(ds,
nodeConcept.getNodeListIdsOfNT().get(j).getIdConcept(),
idThesaurus, writeFileSKOS);
}
}
}
}
} */
public void exportAllConceptsAdvanced(HikariDataSource ds, String idConcept, String idThesaurus, WriteFileSKOS writeFileSKOS, List<NodeLang> selectedLanguages) {
ConceptHelper conceptHelper = new ConceptHelper();
ArrayList<String> listIdsOfConceptChildren = conceptHelper.getListChildrenOfConcept(ds, idConcept, idThesaurus);
NodeConceptExport nodeConcept = conceptHelper.getConceptForExport(ds, idConcept, idThesaurus, isArkActive);
if (nodeConcept.getConcept() == null) {
int k = 0;
return;
}
writeFileSKOS.writeDescriptor(nodeConcept, selectedLanguages);
incrementProgressBar();
for (String listIdsOfConceptChildren1 : listIdsOfConceptChildren) {
nodeConcept = conceptHelper.getConceptForExport(ds, listIdsOfConceptChildren1, idThesaurus, isArkActive);
if (nodeConcept != null) {
writeFileSKOS.writeDescriptor(nodeConcept, selectedLanguages);
incrementProgressBar();
if (!nodeConcept.getNodeListOfNT().isEmpty()) {
for (int j = 0; j < nodeConcept.getNodeListOfNT().size(); j++) {
exportAllConceptsAdvanced(ds, nodeConcept.getNodeListOfNT().get(j).getUri().getIdConcept(), idThesaurus, writeFileSKOS, selectedLanguages);
}
}
}
}
}
Aggregations