질문이 있습니다.Virtuoso TripleStore에서 RDF 트리플을로드 할 때 오류가 발생했습니다.
나는 http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtJenaProvider의 sample8을 따르고 있습니다.
package ExampleVirtuoso;
import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.rdf.model.RDFNode;
import virtuoso.jena.driver.*;
public class ExampleVirtuoso {
public static void main(String[] args) {
/* STEP 1 */
VirtGraph set = new VirtGraph("jdbc:virtuoso://localhost:1111", "dba", "dba");
/* STEP 2 */
System.out.println("\nexecute: CLEAR GRAPH <http://test1>");
String str = "CLEAR GRAPH <http://test1>";
VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(str, set);
vur.exec();
System.out.println("\nexecute: INSERT INTO GRAPH <http://test1> { <aa> <bb> 'cc' . <aa1> <bb1> 123. }");
str = "INSERT INTO GRAPH <http://test1> { <aa> <bb> 'cc' . <aa1> <bb1> 123. }";
vur = VirtuosoUpdateFactory.create(str, set);
vur.exec();
/* STEP 3 */
/* Select all data in virtuoso */
System.out.println("\nexecute: SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
Query sparql = QueryFactory.create("SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
/* STEP 4 */
VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create(sparql, set);
ResultSet results = vqe.execSelect();
while (results.hasNext()) {
QuerySolution rs = results.nextSolution();
RDFNode s = rs.get("s");
RDFNode p = rs.get("p");
RDFNode o = rs.get("o");
System.out.println(" { " + s + " " + p + " " + o + " . }");
}
System.out.println("\nexecute: DELETE FROM GRAPH <http://test1> { <aa> <bb> 'cc' }");
str = "DELETE FROM GRAPH <http://test1> { <aa> <bb> 'cc' }";
vur = VirtuosoUpdateFactory.create(str, set);
vur.exec();
System.out.println("\nexecute: SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
vqe = VirtuosoQueryExecutionFactory.create(sparql, set);
results = vqe.execSelect();
while (results.hasNext()) {
QuerySolution rs = results.nextSolution();
RDFNode s = rs.get("s");
RDFNode p = rs.get("p");
RDFNode o = rs.get("o");
System.out.println(" { " + s + " " + p + " " + o + " . }");
}
}
}
내 빌드 경로에 추가 한이 라이브러리 : 특히
,이 코드가
virtjdbc3.jar
virt_jena.jar
Jena libs
을하지만이 코드를 컴파일 할 때,이 오류가 발생합니다 :
Exception in thread "main" com.hp.hpl.jena.shared.JenaException: virtuoso.jdbc3.VirtuosoException: Connection failed: Connection refused: connect
at virtuoso.jena.driver.VirtGraph.<init>(VirtGraph.java:206)
at virtuoso.jena.driver.VirtGraph.<init>(VirtGraph.java:93)
at ExampleVirtuoso.ExampleVirtuoso.main(ExampleVirtuoso.java:10)
Caused by: virtuoso.jdbc3.VirtuosoException: Connection failed: Connection refused: connect
at virtuoso.jdbc3.VirtuosoConnection.connect(Unknown Source)
at virtuoso.jdbc3.VirtuosoConnection.connect(Unknown Source)
at virtuoso.jdbc3.VirtuosoConnection.<init>(Unknown Source)
at virtuoso.jdbc3.Driver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at virtuoso.jena.driver.VirtGraph.<init>(VirtGraph.java:191)
... 2 more
변경하려고 시도했습니다.
virt_jena.jar
virt_jena2.jar
와
,하지만 난이 오류를 얻을 :
Exception in thread "main" java.lang.NoClassDefFoundError: virtuoso/jdbc4/VirtuosoConnectionPoolDataSource
at virtuoso.jena.driver.VirtGraph.<init>(VirtGraph.java:70)
at virtuoso.jena.driver.VirtGraph.<init>(VirtGraph.java:92)
at ExampleVirtuoso.ExampleVirtuoso.main(ExampleVirtuoso.java:10)
Caused by: java.lang.ClassNotFoundException: virtuoso.jdbc4.VirtuosoConnectionPoolDataSource
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more
I 전제가 기능적으로 거장의에 대해 무지하고 내가 몇 가지 초기 단계를 생략 할 수 있습니다. 라이브러리를 다운로드했습니다. http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VOSDownload#Jena%20Provider
여기서 내가 뭘 잘못하고 있니?
나는 Virtuoso Server를 시작하지 않는다고 생각합니다. 내가 어떻게 할 수 있니? – Musich87
아무 생각없이 설명서를 읽어보십시오. ;-) http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VOSBuild –
Virtuoso 서버를 시작하려면 1) 콘솔 열기 2) 거장이 설치된 경로에서 Cd 'database'폴더로 이동하십시오 3) virtuoso.lck 파일을 삭제하십시오 4) virtuoso-t -f & – Cheryl