Skip to content
Permalink
Browse files

RDF4J Import phase 1 (avec group default)

  • Loading branch information...
Quincy Quincy
Quincy authored and Quincy committed Apr 21, 2017
1 parent 3e62bf2 commit a3c7a9e39eb3b679f8f6f2395d99895a6903f670
Showing with 83,885 additions and 13 deletions.
  1. +2 −0 src/main/java/mom/trd/opentheso/SelectedBeans/FileBean.java
  2. +1 −1 src/main/java/mom/trd/opentheso/SelectedBeans/SelectedThesaurus.java
  3. +176 −0 src/main/java/mom/trd/opentheso/SelectedBeans/rdf4jFileBean.java
  4. +1 −1 src/main/java/mom/trd/opentheso/bdd/helper/ConceptHelper.java
  5. +2 −3 src/main/java/mom/trd/opentheso/bdd/helper/ThesaurusHelper.java
  6. +6 −6 src/main/java/mom/trd/opentheso/core/imports/helper/ImportSkosHelper.java
  7. +424 −0 src/main/java/mom/trd/opentheso/core/imports/rdf4j/ReadRdf4j.java
  8. +653 −0 src/main/java/mom/trd/opentheso/core/imports/rdf4j/helper/ImportRdf4jHelper.java
  9. +52 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSConceptScheme.java
  10. +41 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSCreator.java
  11. +41 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSDate.java
  12. +59 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSDocumentation.java
  13. +42 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSGPSCoordinates.java
  14. +58 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSLabel.java
  15. +32 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSMatch.java
  16. +30 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSNotation.java
  17. +75 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSProperty.java
  18. +52 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSRelation.java
  19. +252 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSResource.java
  20. +22 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSTopConcept.java
  21. +148 −0 src/main/java/mom/trd/opentheso/skosapi/SKOSXmlDocument.java
  22. +56 −0 src/main/webapp/dialogs/import/importSkosRdf4jDlg.xhtml
  23. +8 −2 src/main/webapp/edition.xhtml
  24. +322 −0 src/test/java/rdf4j/ReadRdfFileTest.java
  25. +19 −0 test.rdf
  26. +160 −0 test_unesco.rdf
  27. +2,274 −0 test_unesco3.rdf
  28. +98 −0 testrdf.rdf
  29. +78,779 −0 unescothes.rdf
@@ -30,6 +30,7 @@
import mom.trd.opentheso.core.imports.helper.ImportSkosHelper;
import mom.trd.opentheso.core.imports.helper.ImportTabulateHelper;
import mom.trd.opentheso.core.imports.old.ReadFileSKOS;
import mom.trd.opentheso.core.imports.rdf4j.ReadRdf4j;
import mom.trd.opentheso.core.imports.tabulate.ImportTabuleIntoBDD;
import mom.trd.opentheso.core.imports.tabulate.ReadFileTabule;
import net.coobird.thumbnailator.Thumbnails;
@@ -226,6 +227,7 @@ public void chargeSkos(FileUploadEvent event) {
}
}
}



/**
@@ -467,7 +467,7 @@ public void ajouterTheso(int idUser, int idRole) {
Connection conn = connect.getPoolConnexion().getConnection();
conn.setAutoCommit(false);

String idThesaurus = th.addThesaurusRollBack(conn, editTheso, null, arkActive);
String idThesaurus = th.addThesaurusRollBack(conn, null, arkActive);
if(idThesaurus == null){
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error1")));
conn.rollback();
@@ -0,0 +1,176 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mom.trd.opentheso.SelectedBeans;

import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import javax.faces.event.PhaseId;
import mom.trd.opentheso.bdd.helper.Connexion;
import mom.trd.opentheso.core.imports.rdf4j.ReadRdf4j;
import mom.trd.opentheso.core.imports.rdf4j.helper.ImportRdf4jHelper;
import mom.trd.opentheso.skosapi.SKOSXmlDocument;
import org.primefaces.event.FileUploadEvent;

/**
*
* @author Quincy
*/

@ManagedBean(name = "rdf4jFileBean")
@ViewScoped
public class rdf4jFileBean implements Serializable {

@ManagedProperty(value = "#{poolConnexion}")
private Connexion connect;
private double progress=0;
private double progress_abs=0;
/*
@ManagedProperty(value = "#{langueBean}")
private LanguageBean langueBean;
*/
private String formatDate;
private String uri;
private double total;

private boolean uploadEnable = true;
private boolean BDDinsertEnable = false;

private SKOSXmlDocument sKOSXmlDocument;



public void chargeSkos(FileUploadEvent event) {
progress =0;

if (!PhaseId.INVOKE_APPLICATION.equals(event.getPhaseId())) {
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
event.queue();
} else {
InputStream is = null;

try {
is = event.getFile().getInputstream();
} catch (IOException ex) {
Logger.getLogger(FileBean.class.getName()).log(Level.SEVERE, null, ex);
}
ReadRdf4j readRdf4j = new ReadRdf4j(is);
progress =100;
sKOSXmlDocument = readRdf4j.getsKOSXmlDocument();
total = sKOSXmlDocument.getConceptList().size() + sKOSXmlDocument.getGroupList().size() + 1 ;
uri = sKOSXmlDocument.getTitle();
uploadEnable = false;
BDDinsertEnable = true;


}
}

public void insertBDD(int idUser, int idRole) {

progress =0;
progress_abs=0;
ImportRdf4jHelper importRdf4jHelper = new ImportRdf4jHelper();
importRdf4jHelper.setInfos(connect.getPoolConnexion(), formatDate, uploadEnable, "adresse",idUser, idRole, /*langueBean.getIdLangue()*/"fr");
importRdf4jHelper.setRdf4jThesaurus(sKOSXmlDocument);
importRdf4jHelper.addThesaurus();
progress_abs++;
progress = progress_abs/total *100;
importRdf4jHelper.addGroups(this);
importRdf4jHelper.addConcepts(this);

uploadEnable = true;
BDDinsertEnable = false;
uri = null;
total = 0;
}

public String getFormatDate() {
return formatDate;
}

public void setFormatDate(String formatDate) {
this.formatDate = formatDate;
}

public String getUri() {
return uri;
}

public void setUri(String uri) {
this.uri = uri;
}

public double getTotal() {
return total;
}

public void setTotal(double total) {
this.total = total;
}

public boolean isUploadEnable() {
return uploadEnable;
}

public void setUploadEnable(boolean uploadEnable) {
this.uploadEnable = uploadEnable;
}

public boolean isBDDinsertEnable() {
return BDDinsertEnable;
}

public void setBDDinsertEnable(boolean BDDinsertEnable) {
this.BDDinsertEnable = BDDinsertEnable;
}

public Connexion getConnect() {
return connect;
}

public void setConnect(Connexion connect) {
this.connect = connect;
}

public SKOSXmlDocument getsKOSXmlDocument() {
return sKOSXmlDocument;
}

public void setsKOSXmlDocument(SKOSXmlDocument sKOSXmlDocument) {
this.sKOSXmlDocument = sKOSXmlDocument;
}

public int getProgress() {
return (int)progress;
}

public void setProgress(double progress) {
this.progress = progress;
}

public double getAbs_progress() {
return progress_abs;
}

public void setAbs_progress(double abs_progress) {
this.progress_abs = abs_progress;
}









}
@@ -1110,7 +1110,7 @@ public boolean addLinkHierarchicalRelation(Connection conn,
HierarchicalRelationship hierarchicalRelationship, int idUser) {

// Connection conn;
Statement stmt;
Statement stmt;

try {
//conn.setAutoCommit(false);
@@ -127,12 +127,11 @@ public String addThesaurus(HikariDataSource ds, Thesaurus thesaurus,
* ou null
*
* @param conn
* @param thesaurus
* @param urlSite
* @param isArkActive
* @return String Id du thésaurus rajouté
*/
public String addThesaurusRollBack(Connection conn, Thesaurus thesaurus,
public String addThesaurusRollBack(Connection conn,
String urlSite, boolean isArkActive) {

String idThesaurus = null;
@@ -186,7 +185,7 @@ public String addThesaurusRollBack(Connection conn, Thesaurus thesaurus,
+ "current_date)";

stmt.executeUpdate(query);
thesaurus.setId_thesaurus(idThesaurus);
// thesaurus.setId_thesaurus(idThesaurus);
/* if(thesaurus.getTitle().isEmpty()) {
thesaurus.setTitle("theso_" + idThesaurus);
}
@@ -292,7 +292,7 @@ private boolean addThesaurusToBdd(ThesaurusHelper thesaurusHelper){
if(thesaurus.getLanguage() == null) {
thesaurus.setLanguage(langueSource);
}
if( (idTheso = thesaurusHelper.addThesaurusRollBack(conn, thesaurus, adressSite, useArk)) == null){
if( (idTheso = thesaurusHelper.addThesaurusRollBack(conn, adressSite, useArk)) == null){
conn.rollback();
conn.close();
return false;
@@ -449,12 +449,12 @@ public boolean addConcepts() {

conceptsCount = dataSet.getSKOSConcepts().size();
// i can get all the concepts from this scheme
for (SKOSConcept conceptsInScheme : dataSet.getSKOSConcepts()) {
for (SKOSConcept skosConcept : dataSet.getSKOSConcepts()) {
// URI du Concept récupération automatique de l'identifiant
String id = getIdFromUri(conceptsInScheme.getURI().toString());
String id = getIdFromUri(skosConcept.getURI().toString());

if(id == null || id.isEmpty()) {
message = message + "identifiant null pour l'URI : " + conceptsInScheme.getURI().toString();
message = message + "identifiant null pour l'URI : " + skosConcept.getURI().toString();
continue;
}
else {
@@ -474,9 +474,9 @@ public boolean addConcepts() {
}*/

concept.setStatus("");
concept.setIdArk(conceptsInScheme.getURI().toString());
concept.setIdArk(skosConcept.getURI().toString());

for (SKOSAnnotation anno : conceptsInScheme.getSKOSAnnotations(dataSet)) {
for (SKOSAnnotation anno : skosConcept.getSKOSAnnotations(dataSet)) {

// c'est une valeur
if (anno.isAnnotationByConstant()) {

0 comments on commit a3c7a9e

Please sign in to comment.
You can’t perform that action at this time.