use of skos.SKOSTopConcept in project opentheso by miledrousset.
the class SkosToJsonldSchemaOrg method addElementInScheme.
private void addElementInScheme(ArrayList<SKOSTopConcept> sKOSTopConcepts, String nameSpace) {
String element;
if (sKOSTopConcepts.size() > 1) {
endElement();
element = " \"" + nameSpaceSkosCore + nameSpace + "\": [\n";
boolean first = true;
for (SKOSTopConcept sKOSTopConcept : sKOSTopConcepts) {
if (!first)
element += " },\n";
element += " {\n";
element += " \"@id\": \"" + sKOSTopConcept.getTopConcept() + "\"\n";
first = false;
}
element += " }\n";
element += " ]";
} else {
endElement();
element = " \"" + nameSpaceSkosCore + nameSpace + "\": {\n";
for (SKOSTopConcept sKOSTopConcept : sKOSTopConcepts) {
element += " \"@id\": \"" + sKOSTopConcept.getTopConcept() + "\"\n";
element += " }";
}
}
jsonLd.append(element);
}
use of skos.SKOSTopConcept in project opentheso by miledrousset.
the class WriteFileSKOS_Frantiq method writeTopConcepts.
boolean writeTopConcepts(String idGroup) {
SKOSTopConcept topConcept = new SKOSTopConcept(URI + "concept#" + idGroup);
// skos = skos + topConcept.toString();
skosBuff.append(topConcept.toString());
return true;
}
use of skos.SKOSTopConcept in project opentheso by miledrousset.
the class WriteSkosBDD method writeThesaurus.
public void writeThesaurus(SKOSXmlDocument skosDocument, String dateFormat, boolean useArk, String adressSite, int idUser, String langueSource) {
SKOSConceptScheme conceptScheme = skosDocument.getConceptScheme();
ArrayList<SKOSTopConcept> topConceptsList = conceptScheme.getTopConceptsList();
ArrayList<SKOSResource> resourcesList = skosDocument.getResourcesList();
/*
* Création du Thésaurus
*/
String descriptionThesaurus = getThesaurusName(conceptScheme.getUri());
// if(!query.thesaurusExistLangue(descriptionThesaurus, id_langueSource)) {
ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
Thesaurus thesaurus = new Thesaurus();
thesaurus.setTitle(descriptionThesaurus);
thesaurus.setLanguage(langueSource);
String idThesaurus = thesaurusHelper.addThesaurus(ds, thesaurus, adressSite, useArk);
if (idThesaurus == null)
return;
thesaurus.setId_thesaurus(idThesaurus);
try {
Connection conn = ds.getConnection();
conn.setAutoCommit(false);
UserHelper userHelper = new UserHelper();
int idRole = userHelper.getRoleOfUser(ds, idUser);
if (!userHelper.addRole(conn, idUser, idRole, idThesaurus, "")) {
conn.rollback();
conn.close();
return;
}
conn.commit();
conn.close();
} catch (SQLException ex) {
Logger.getLogger(WriteSkosBDD.class.getName()).log(Level.SEVERE, null, ex);
}
// Si le Titre du thésaurus n'est pas detecter, on donne un nom par defaut
if (conceptScheme.getSkosLabels().isEmpty()) {
if (thesaurus.getTitle().isEmpty()) {
thesaurus.setTitle("Theso_" + idThesaurus);
thesaurusHelper.addThesaurusTraduction(ds, thesaurus);
}
}
for (SKOSLabel skosLabel : conceptScheme.getSkosLabels()) {
thesaurus.setTitle(skosLabel.getLabel());
thesaurus.setLanguage(skosLabel.getLanguage());
thesaurusHelper.addThesaurusTraduction(ds, thesaurus);
}
idsTopConcept = new ArrayList<>();
for (SKOSResource resource : resourcesList) {
if (resource != null) {
if (!isDescriptor(resource, topConceptsList)) {
// on insère un domaine
writeDomaine(resource, idThesaurus, "fr", adressSite, useArk, idUser);
} else {
// on insère un concept
writeConcept(resource, idThesaurus, "fr", dateFormat, adressSite, useArk, idUser);
}
}
}
// ici la fin du fichier on controle si le thésaurus a toutes les langues des concepts
// Vérifier l'existence de la langue et l'ajouter si elle n'existe pas déjà
addLangsToThesaurus(ds, idThesaurus);
}
use of skos.SKOSTopConcept in project opentheso by miledrousset.
the class SkosToJsonld method addElementInScheme.
private void addElementInScheme(ArrayList<SKOSTopConcept> sKOSTopConcepts, String nameSpace) {
String element;
String uri;
StringPlus stringPlus = new StringPlus();
if (sKOSTopConcepts.size() > 1) {
endElement();
element = " \"" + nameSpaceSkosCore + nameSpace + "\": [\n";
boolean first = true;
for (SKOSTopConcept sKOSTopConcept : sKOSTopConcepts) {
if (!first)
element += " },\n";
element += " {\n";
uri = stringPlus.normalizeStringForXml(sKOSTopConcept.getTopConcept());
element += " \"@id\": \"" + uri + "\"\n";
first = false;
}
element += " }\n";
element += " ]";
} else {
endElement();
element = " \"" + nameSpaceSkosCore + nameSpace + "\": {\n";
for (SKOSTopConcept sKOSTopConcept : sKOSTopConcepts) {
uri = stringPlus.normalizeStringForXml(sKOSTopConcept.getTopConcept());
element += " \"@id\": \"" + uri + "\"\n";
element += " }";
}
}
jsonLd.append(element);
}
use of skos.SKOSTopConcept in project opentheso by miledrousset.
the class WriteFileSKOS method writeTopConcepts.
boolean writeTopConcepts(String idGroup, String idThesaurus) {
SKOSTopConcept topConcept = new SKOSTopConcept(URI + "?idg=" + idGroup + "&idt=" + idThesaurus);
// skos = skos + topConcept.toString();
skosBuff.append(topConcept.toString());
// System.out.println("écriture du TopConcept : " + idGroup);
return true;
}
Aggregations