use of mom.trd.opentheso.bdd.helper.nodes.NodeUri in project opentheso by miledrousset.
the class ExportFromBDD method exportGroup.
/**
* Fonction récursive permettant d'exporter le Groupe de la tête jusqu'au
* dernier descripteur
*
* @param ds
* @param idThesaurus
* @param idGroup
* @return
*/
public StringBuffer exportGroup(HikariDataSource ds, String idThesaurus, String idGroup) {
WriteFileSKOS writeFileSKOS = new WriteFileSKOS();
// inititialisation des URI
writeFileSKOS.setServerArk(serverArk);
writeFileSKOS.setServerAdress(serverAdress);
writeFileSKOS.setNodePreference(nodePreference);
writeFileSKOS.writeHeader();
// ecriture des TopConcept
GroupHelper conceptGroupHelper = new GroupHelper();
// écriture des Domaines et Descripteurs avec traductions
NodeGroupLabel nodeGroupLabel = conceptGroupHelper.getNodeGroupLabel(ds, idGroup, idThesaurus);
ArrayList<NodeUri> idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, idGroup, idThesaurus);
writeFileSKOS.writeGroup(nodeGroupLabel, idOfTopConcept, null);
// écriture des TopConcepts
for (NodeUri idOfTopConcept1 : idOfTopConcept) {
exportAllConcepts(ds, idOfTopConcept1.getIdConcept(), idThesaurus, writeFileSKOS);
}
writeFileSKOS.endSkos();
return writeFileSKOS.getSkosBuff();
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeUri in project opentheso by miledrousset.
the class ExportFromBDD method exportThisGroup.
/**
* Fonction permettant d'exporter un noeud Groupe (un seul identifiant group)
*
* @param ds
* @param idThesaurus
* @param idGroup
* @return Skos
*/
public StringBuffer exportThisGroup(HikariDataSource ds, String idThesaurus, String idGroup) {
WriteFileSKOS writeFileSKOS = new WriteFileSKOS();
// inititialisation des URI
writeFileSKOS.setServerArk(serverArk);
writeFileSKOS.setServerAdress(serverAdress);
writeFileSKOS.writeHeader();
// ecriture des TopConcept
GroupHelper conceptGroupHelper = new GroupHelper();
// écriture des Domaines et Descripteurs avec traductions
NodeGroupLabel nodeGroupLabel = conceptGroupHelper.getNodeGroupLabel(ds, idGroup, idThesaurus);
nodeGroupLabel.setIdArk(new GroupHelper().getIdArkOfGroup(ds, idGroup, idThesaurus));
ArrayList<NodeUri> idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, idGroup, idThesaurus);
writeFileSKOS.writeGroup(nodeGroupLabel, idOfTopConcept, null);
writeFileSKOS.endSkos();
return writeFileSKOS.getSkosBuff();
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeUri in project opentheso by miledrousset.
the class ExportFromBDD_Frantiq method exportGroup.
/**
* Fonction récursive permettant d'exporter le Groupe de la tête jusqu'au
* dernier descripteur
*
* @param ds
* @param idThesaurus
* @param idGroup
* @return
*/
public StringBuffer exportGroup(HikariDataSource ds, String idThesaurus, String idGroup) {
WriteFileSKOS_Frantiq writeFileSKOS = new WriteFileSKOS_Frantiq();
// inititialisation des URI
writeFileSKOS.setServerArk(serverArk);
writeFileSKOS.setServerAdress(serverAdress);
writeFileSKOS.writeHeader();
// ecriture des TopConcept
GroupHelper conceptGroupHelper = new GroupHelper();
// écriture des Domaines et Descripteurs avec traductions
NodeGroupLabel nodeGroupLabel = conceptGroupHelper.getNodeGroupLabel(ds, idGroup, idThesaurus);
ArrayList<NodeUri> idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, idGroup, idThesaurus);
writeFileSKOS.writeGroup(nodeGroupLabel, idOfTopConcept);
// écriture des TopConcepts
for (NodeUri idOfTopConcept1 : idOfTopConcept) {
exportAllConcepts(ds, idOfTopConcept1.getIdConcept(), idThesaurus, writeFileSKOS);
}
writeFileSKOS.endSkos();
return writeFileSKOS.getSkosBuff();
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeUri in project opentheso by miledrousset.
the class ExportFromBDD_Frantiq method exportBranchOfConcept.
/**
* Fonction permet d'exporter une branche complète d'un thésaurus
* en partant de n'importe quel concept, mais pas d'un Domaine
* @param ds
* @param idConcept
* @param idThesaurus
* @return
*/
public StringBuffer exportBranchOfConcept(HikariDataSource ds, String idThesaurus, String idConcept) {
WriteFileSKOS_Frantiq writeFileSKOS = new WriteFileSKOS_Frantiq();
// inititialisation des URI
writeFileSKOS.setServerArk(serverArk);
writeFileSKOS.setServerAdress(serverAdress);
writeFileSKOS.writeHeader();
NodeUri nodeUri = new NodeUri();
nodeUri.setIdConcept(idConcept);
exportAllConcepts(ds, nodeUri.getIdConcept(), idThesaurus, writeFileSKOS);
writeFileSKOS.endSkos();
return writeFileSKOS.getSkosBuff();
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeUri in project opentheso by miledrousset.
the class WriteFileSKOS method writeGroup.
/**
* @param nodeGroupLabel
* @param listIdOfTopConcept
* @param selectedLanguages
*
* @return true ou false
*/
public boolean writeGroup(NodeGroupLabel nodeGroupLabel, ArrayList<NodeUri> listIdOfTopConcept, List<NodeLang> selectedLanguages) {
SKOSResource concept;
if (nodeGroupLabel.getIdArk() == null || nodeGroupLabel.getIdArk().trim().isEmpty()) {
/*
Cette partie est pour l'export des PACTOLS pour Frantiq
*/
// concept = new SKOSResource(serverAdress + "#" + nodeGroupLabel.getIdGroup());
concept = new SKOSResource(serverAdress + "?idg=" + nodeGroupLabel.getIdGroup() + "&idt=" + nodeGroupLabel.getIdThesaurus());
} else {
concept = new SKOSResource(serverArk + nodeGroupLabel.getIdArk());
}
for (int i = 0; i < nodeGroupLabel.getNodeGroupTraductionses().size(); i++) {
if (selectedLanguages != null) {
// nodeGroupLabel.getNodeGroupTraductionses().get(i).getIdLang().equalsIgnoreCase("fr"))
for (NodeLang selectedLanguage : selectedLanguages) {
if (nodeGroupLabel.getNodeGroupTraductionses().get(i).getIdLang().equalsIgnoreCase(selectedLanguage.getCode())) {
concept.addLabel(nodeGroupLabel.getNodeGroupTraductionses().get(i).getTitle(), nodeGroupLabel.getNodeGroupTraductionses().get(i).getIdLang(), SKOSProperty.prefLabel);
}
}
} else {
concept.addLabel(nodeGroupLabel.getNodeGroupTraductionses().get(i).getTitle(), nodeGroupLabel.getNodeGroupTraductionses().get(i).getIdLang(), SKOSProperty.prefLabel);
}
}
if (!nodeGroupLabel.getNodeGroupTraductionses().isEmpty()) {
concept.addDate(nodeGroupLabel.getNodeGroupTraductionses().get(0).getCreated().toString(), SKOSProperty.created);
concept.addDate(nodeGroupLabel.getNodeGroupTraductionses().get(0).getModified().toString(), SKOSProperty.modified);
}
if (!nodeGroupLabel.getIdGroup().isEmpty()) {
concept.addIdentifier(nodeGroupLabel.getIdGroup(), SKOSProperty.identifier);
}
for (NodeUri listIdOfTopConcept1 : listIdOfTopConcept) {
if (listIdOfTopConcept1.getIdArk() == null || listIdOfTopConcept1.getIdArk().trim().isEmpty()) {
concept.addRelation(serverAdress + "?idc=" + listIdOfTopConcept1.getIdConcept() + "&idt=" + nodeGroupLabel.getIdThesaurus(), SKOSProperty.narrower);
} else {
concept.addRelation(serverArk + listIdOfTopConcept1.getIdArk(), SKOSProperty.narrower);
}
}
skosBuff.append(" ").append(concept.toString());
return true;
}
Aggregations