use of skos.SKOSMapping in project opentheso by miledrousset.
the class WriteBranchSkosBDD method writeFirstConceptAfterGroup.
private boolean writeFirstConceptAfterGroup(SKOSResource resource, String idGroup, String idThesaurus, String id_langueSource, String dateFormat, String adressSite, boolean useArk, int idUser) {
RelationsHelper relationsHelper = new RelationsHelper();
// ajout du concept dans la base
Concept concept = new Concept();
ConceptHelper conceptHelper = new ConceptHelper();
if (idGroup.trim().isEmpty())
return false;
String idC = getId(resource.getUri());
concept.setIdConcept(idC);
// concept.setCreated(null);
concept.setIdThesaurus(idThesaurus);
concept.setNotation("");
concept.setStatus("");
concept.setTopConcept(true);
concept.setIdGroup(idGroup);
concept = addDates(resource.getDateList(), concept, dateFormat);
conceptHelper.insertConceptInTable(ds, concept, idUser);
// ajout des termes et traductions
NodeTerm nodeTerm = new NodeTerm();
nodeTerm.setNodeTermTraduction(getTraductionConcept(resource.getLabelsList()));
nodeTerm.setIdTerm(idC);
nodeTerm.setIdConcept(idC);
nodeTerm.setIdThesaurus(idThesaurus);
nodeTerm.setSource("");
nodeTerm.setStatus("");
nodeTerm = addDatesTerm(resource.getDateList(), nodeTerm, dateFormat);
TermHelper termHelper = new TermHelper();
termHelper.insertTerm(ds, nodeTerm, idUser);
// ajouter les notes
ArrayList<NodeNote> nodeNoteList = addNotes(resource.getDocumentationsList());
NoteHelper noteHelper = new NoteHelper();
for (NodeNote nodeNoteList1 : nodeNoteList) {
if (nodeNoteList1.getNotetypecode().contains("scopeNote")) {
noteHelper.addConceptNote(ds, concept.getIdConcept(), nodeNoteList1.getLang(), idThesaurus, nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
if (nodeNoteList1.getNotetypecode().contains("historyNote")) {
noteHelper.addConceptNote(ds, concept.getIdConcept(), nodeNoteList1.getLang(), idThesaurus, nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
if (nodeNoteList1.getNotetypecode().contains("definition")) {
noteHelper.addTermNote(ds, nodeTerm.getIdTerm(), nodeNoteList1.getLang(), idThesaurus, nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
if (nodeNoteList1.getNotetypecode().contains("editorialNote")) {
noteHelper.addTermNote(ds, nodeTerm.getIdTerm(), nodeNoteList1.getLang(), idThesaurus, nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
}
// Enregistrer les relations sans les BT
writeRelationsList(resource.getRelationsList(), concept.getIdConcept(), idThesaurus, idUser);
ArrayList<SKOSMapping> sKOSMappings = resource.getMappings();
// Enregistrer les Mappings (alignements)
AlignmentHelper alignmentHelper = new AlignmentHelper();
for (SKOSMapping sKOSMapping : sKOSMappings) {
if (sKOSMapping.getProperty() == SKOSProperty.exactMatch) {
alignmentHelper.addNewAlignment(ds, // user
1, // concept target
"", // thesaurus target
"", // URI
sKOSMapping.getTargetUri(), 1, concept.getIdConcept(), idThesaurus, 0);
}
if (sKOSMapping.getProperty() == SKOSProperty.closeMatch) {
alignmentHelper.addNewAlignment(ds, // user
1, // concept target
"", // thesaurus target
"", // URI
sKOSMapping.getTargetUri(), 2, concept.getIdConcept(), idThesaurus, 0);
}
}
// Ajouter l'id du concept importé pour l'aligner avec le thésaurus source
alignmentHelper.addNewAlignment(ds, // user
1, // concept target
"", // thesaurus target
"", // URI de la source
resource.getUri(), // sKOSMapping.getTargetUri(), // URI
1, concept.getIdConcept(), idThesaurus, 0);
// Enregister les synonymes et traductions
ArrayList<NodeEM> nodeEMs = writeLabelsList(ds, resource.getLabelsList());
Term term = new Term();
for (int i = 0; i < nodeEMs.size(); i++) {
term.setId_concept(concept.getIdConcept());
term.setId_term(nodeTerm.getIdTerm());
term.setLexical_value(nodeEMs.get(i).getLexical_value());
term.setLang(nodeEMs.get(i).getLang());
term.setId_thesaurus(idThesaurus);
term.setSource(nodeEMs.get(i).getSource());
term.setStatus(nodeEMs.get(i).getStatus());
termHelper.addNonPreferredTerm(ds, term, idUser);
}
return true;
}
use of skos.SKOSMapping in project opentheso by miledrousset.
the class WriteBranchSkosBDD method writeConcept.
private void writeConcept(SKOSResource resource, String idConcept, String idGroup, String idThesaurus, String id_langueSource, String dateFormat, String adressSite, boolean useArk, int idUser) {
// ajout du concept dans la base
Concept concept = new Concept();
ConceptHelper conceptHelper = new ConceptHelper();
if (idConcept.trim().isEmpty())
return;
String idC = getId(resource.getUri());
concept.setIdConcept(idC);
// concept.setCreated(null);
concept.setIdThesaurus(idThesaurus);
concept.setNotation("");
concept.setStatus("");
concept.setTopConcept(false);
concept.setIdGroup(idGroup);
concept = addDates(resource.getDateList(), concept, dateFormat);
if (idGroup.trim().isEmpty())
return;
conceptHelper.insertConceptInTable(ds, concept, idUser);
// ajout des termes et traductions
NodeTerm nodeTerm = new NodeTerm();
nodeTerm.setNodeTermTraduction(getTraductionConcept(resource.getLabelsList()));
nodeTerm.setIdTerm(idC);
nodeTerm.setIdConcept(idC);
nodeTerm.setIdThesaurus(idThesaurus);
nodeTerm.setSource("");
nodeTerm.setStatus("");
nodeTerm = addDatesTerm(resource.getDateList(), nodeTerm, dateFormat);
TermHelper termHelper = new TermHelper();
termHelper.insertTerm(ds, nodeTerm, idUser);
// ajouter les notes
ArrayList<NodeNote> nodeNoteList = addNotes(resource.getDocumentationsList());
NoteHelper noteHelper = new NoteHelper();
for (NodeNote nodeNoteList1 : nodeNoteList) {
if (nodeNoteList1.getNotetypecode().contains("scopeNote")) {
noteHelper.addConceptNote(ds, concept.getIdConcept(), nodeNoteList1.getLang(), idThesaurus, nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
if (nodeNoteList1.getNotetypecode().contains("historyNote")) {
noteHelper.addConceptNote(ds, concept.getIdConcept(), nodeNoteList1.getLang(), idThesaurus, nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
if (nodeNoteList1.getNotetypecode().contains("definition")) {
noteHelper.addTermNote(ds, nodeTerm.getIdTerm(), nodeNoteList1.getLang(), idThesaurus, nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
if (nodeNoteList1.getNotetypecode().contains("editorialNote")) {
noteHelper.addTermNote(ds, nodeTerm.getIdTerm(), nodeNoteList1.getLang(), idThesaurus, nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
}
}
// Enregistrer les relations
writeRelationsList(resource.getRelationsList(), concept.getIdConcept(), idThesaurus, idUser);
ArrayList<SKOSMapping> sKOSMappings = resource.getMappings();
// Enregistrer les Mappings (alignements)
AlignmentHelper alignmentHelper = new AlignmentHelper();
for (SKOSMapping sKOSMapping : sKOSMappings) {
if (sKOSMapping.getProperty() == SKOSProperty.exactMatch) {
alignmentHelper.addNewAlignment(ds, // user
1, // concept target
"", // thesaurus target
"", // URI
sKOSMapping.getTargetUri(), 1, concept.getIdConcept(), idThesaurus, 0);
}
if (sKOSMapping.getProperty() == SKOSProperty.closeMatch) {
alignmentHelper.addNewAlignment(ds, // user
1, // concept target
"", // thesaurus target
"", // URI
sKOSMapping.getTargetUri(), 2, concept.getIdConcept(), idThesaurus, 0);
}
}
// Ajouter l'id du concept importé pour l'aligner avec le thésaurus source
alignmentHelper.addNewAlignment(ds, // user
1, // concept target
"", // thesaurus target
"", // URI de la source
resource.getUri(), // sKOSMapping.getTargetUri(), // URI
1, concept.getIdConcept(), idThesaurus, 0);
// Enregister les synonymes et traductions
ArrayList<NodeEM> nodeEMs = writeLabelsList(ds, resource.getLabelsList());
Term term = new Term();
for (int i = 0; i < nodeEMs.size(); i++) {
term.setId_concept(concept.getIdConcept());
term.setId_term(nodeTerm.getIdTerm());
term.setLexical_value(nodeEMs.get(i).getLexical_value());
term.setLang(nodeEMs.get(i).getLang());
term.setId_thesaurus(idThesaurus);
term.setSource(nodeEMs.get(i).getSource());
term.setStatus(nodeEMs.get(i).getStatus());
termHelper.addNonPreferredTerm(ds, term, idUser);
}
}
use of skos.SKOSMapping in project opentheso by miledrousset.
the class SkosToJsonld method addElementMapping.
private void addElementMapping(ArrayList<SKOSMapping> skosRelation, String nameSpace) {
String element;
String uri;
StringPlus stringPlus = new StringPlus();
if (skosRelation.size() > 1) {
boolean first = true;
endElement();
element = " \"" + nameSpaceSkosCore + nameSpace + "\": [\n";
for (SKOSMapping skosRelation1 : skosRelation) {
if (!first)
element += " },\n";
element += " {\n";
uri = stringPlus.normalizeStringForXml(skosRelation1.getTargetUri());
element += " \"@id\": \"" + uri + "\"\n";
first = false;
}
element += " }\n";
element += " ]";
} else {
endElement();
element = " \"" + nameSpaceSkosCore + nameSpace + "\": {\n";
for (SKOSMapping skosRelation1 : skosRelation) {
uri = stringPlus.normalizeStringForXml(skosRelation1.getTargetUri());
element += " \"@id\": \"" + uri + "\"\n";
element += " }";
}
}
jsonLd.append(element);
}
use of skos.SKOSMapping in project opentheso by miledrousset.
the class SkosToJsonldSchemaOrg method addSameAs.
/**
* Ajout des dates à Json
* @param dates
*/
private void addSameAs(ArrayList<SKOSMapping> sameAs) {
String mapping;
endElement();
mapping = " \"sameAs" + "\": [\n";
boolean first = true;
for (SKOSMapping sameAs1 : sameAs) {
if (!first)
mapping += ",\n";
mapping += " \"" + sameAs1.getTargetUri() + "\"";
first = false;
}
mapping += "\n ]";
jsonLd.append(mapping);
}
Aggregations