Hi guys, I have a little problem with the relation about Java and OrientDB.
First: I connect my ETL with DDBB created in OrientDB.
Second: I import my CSV data to my Java proyect.
Third: i can create the vertex and edges for OrientDB in my Java proyect.
Fourth: I try to introduce the CSV data in the databases vertex and edge
All is ok but when I start the query in OrientDB I cant see the datas.
Where is my problem? Anyone can help me?
Thank you so much.
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.TransactionalGraph;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class csvToOrientdb {
public static void main(String[] args) {
csvToOrientdb cto = new csvToOrientdb();
cto.run();
}
public void run() {
TransactionalGraph graph = new OrientGraph("plocal:myDB", "admin",
"admin");
BufferedReader br = null;
String data = "";
String csvSplitBy = ";";
int numDumb = 1;
int keyNum = 1;
Vertex Key, DeveloperEmail, CertificatePublicKey,
CertificateFingerprint, DeveloperName, CertificateSubjectCommonName;
Edge relacion1, relacion2, relacion3, relacion4, relacion5,
relacion6, relacion7, relacion8, relacion9;
try {
for (int i = 0; i < numDumb; i++) {
String csvFile = "C:\\Users\\DANI\\Desktop\\dumps\\dump_" +
i;
try {
br = new BufferedReader(new FileReader(csvFile));
while ((data = br.readLine()) != null) {
String[] datos = data.split(csvSplitBy, 15);
Key = graph.addVertex(datos[0]);
Key.setProperty("sha256", datos[1]);
Key.setProperty("packageName", datos[2]);
Key.setProperty("origin", datos[3]);
Key.setProperty("versionCode", datos[4]);
Key.setProperty("certificateValidityGapRoundedYears", datos[10]);
DeveloperEmail = graph.addVertex(datos[5]);
DeveloperName = graph.addVertex(datos[6]);
DeveloperName.setProperty("developerAddress",
datos[13]);
DeveloperName.setProperty("developerPrivacy",
datos[14]);
DeveloperName.setProperty("developerWeb", datos[7]);
CertificatePublicKey = graph.addVertex(datos[8]);
CertificateFingerprint = graph.addVertex(datos[9]);
CertificateSubjectCommonName =
graph.addVertex(datos[11]);
CertificateSubjectCommonName.setProperty("certificateIssuerCommonName",
datos[12]);
relacion1 = graph.addEdge(null,
CertificateFingerprint, DeveloperEmail, "used_by ");
relacion2 = graph.addEdge(null, DeveloperEmail,
Key, "developer_of ");
relacion3 = graph.addEdge(null,
CertificateFingerprint, Key, "sign ");
relacion4 = graph.addEdge(null, DeveloperName,
DeveloperEmail, "has_email ");
relacion5 = graph.addEdge(null,
CertificateSubjectCommonName, CertificateFingerprint, "in_cert ");
relacion6 = graph.addEdge(null,
CertificateSubjectCommonName, CertificatePublicKey, "appears_with ");
relacion7 = graph.addEdge(null,
CertificatePublicKey, CertificateFingerprint, "in_cert ");
relacion8 = graph.addEdge(null, DeveloperEmail,
CertificateFingerprint, "sign_with ");
relacion9 = graph.addEdge(null,
CertificatePublicKey, CertificateSubjectCommonName, "sign_in ");
keyNum++;
System.out.println("Dumb done numer : " + i + "
keys: " + keyNum);
graph.commit();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
graph.rollback();
} finally {
graph.shutdown();
}
}
}
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.