Browse files

change xcc lib to 4.2.3

add insertion code
  • Loading branch information...
1 parent 56583a5 commit 6c48115788b948b9a73ea05ca207199f3a03a20a @lidingpku lidingpku committed Apr 18, 2011
View
2 .classpath
@@ -37,6 +37,6 @@
<classpathentry kind="lib" path="lib/pellet2.2.2/xsdlib/xsdlib.jar"/>
<classpathentry kind="lib" path="lib/pellet2.2.2/jena/arq-2.8.4.jar"/>
<classpathentry kind="lib" path="lib/sw4j-0.6.jar"/>
- <classpathentry kind="lib" path="lib/xcc.jar"/>
+ <classpathentry kind="lib" path="lib/marklogic-xcc-4.2.3.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
View
52 data/bakesale/sparql/bakesale-query-33.sparql
@@ -1,32 +1,28 @@
# bakesale-query-33: list student and manager pairs, each of which is connected by no more than three hops social relation
-PREFIX c: <http://lod-apps.googlecode.com/svn/trunk/data/bakesale/bs-ontology.ttl#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-SELECT distinct ?student ?manager ?o1 ?o2
-WHERE {
- ?student a c:Student .
- FILTER (?student != ?manager )
- {
- {
- ?student c:social_relation ?manager .
- }
+PREFIX c: <http://lod-apps.googlecode.com/svn/trunk/data/bakesale/bs-ontology.ttl#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+SELECT distinct ?student ?manager ?o1 ?o2
+WHERE {
+ ?student a c:Student .
+ ?manager a c:Manager.
+ filter (?student != ?manager )
+ {
+ { ?student c:social_relation ?manager .
+ }
UNION
- {
- ?student c:social_relation ?o1.
- ?o1 c:social_relation ?manager .
- FILTER (?student != ?o1 && ?manager != ?o1 )
- }
- UNION
- {
- ?student c:social_relation ?o1.
- ?o1 c:social_relation ?o2.
- ?o2 c:social_relation ?manager .
- FILTER (
- ?student != ?o1 && ?manager != ?o1
- && ?student != ?o2 && ?manager != ?o2
- && ?o1 != ?o2 )
- }
- }
- ?manager a c:Manager.
-}
+ { ?student c:social_relation ?o1.
+ ?o1 c:social_relation ?manager .
+ filter (?student != ?o1 && ?manager != ?o1 )
+ }
+ UNION
+ { ?student c:social_relation ?o1.
+ ?o1 c:social_relation ?o2.
+ ?o2 c:social_relation ?manager .
+ filter ( ?student != ?o1 && ?manager != ?o1
+ && ?student != ?o2 && ?manager != ?o2
+ && ?o1 != ?o2 )
+ }
+ }
+}
ORDER BY ?o2 ?o1
View
BIN lib/marklogic-xcc-4.2.3.jar
Binary file not shown.
View
27 src/com/marklogic/sparql2xquery/example/ExampleBakesale.java
@@ -23,7 +23,11 @@
import sw4j.util.Sw4jException;
public class ExampleBakesale {
-
+ /*********************************************
+ * config
+ */
+ //String connectionUri = "xcc://admin:admin@localhost:8006/bakesale-full";
+ String connectionUri = "xcc://admin:admin@ec2-184-73-4-47.compute-1.amazonaws.com:8005/bakesale";
public static void main(String [] args){
new ExampleBakesale().run();
@@ -175,6 +179,24 @@ private String getDataUrl(String szFileName){
String szTextInsert = S2XTranslator.translateRdfDataToMarkLogicInsert(m, szNamedGraph);
m_map_url_insert.put(szNamedGraph, szTextInsert);
+
+ //insert
+ ToolMarkLogicQueryRunner cq;
+ try {
+ cq = new ToolMarkLogicQueryRunner(new URI(connectionUri));
+ cq.executeToSingleString(szTextInsert,"\n");
+
+ } catch (XccConfigException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (RequestException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
}
}
return m_map_url_insert;
@@ -273,8 +295,7 @@ private String getDataUrl(String szFileName){
for (String szQueryName: m_map_query_xquery.keySet()){
String szQueryXquery = m_map_query_xquery.get(szQueryName);
- String connectionUri = "xcc://admin:admin@localhost:8006/bakesale-full";
-
+
ToolMarkLogicQueryRunner cq;
try {
cq = new ToolMarkLogicQueryRunner(new URI(connectionUri));
View
5 src/com/marklogic/sparql2xquery/example/Test.java
@@ -6,9 +6,12 @@
import com.marklogic.xcc.exceptions.RequestException;
import com.marklogic.xcc.exceptions.XccConfigException;
+// Test server: http://ec2-184-73-4-47.compute-1.amazonaws.com:8001/
+
public class Test {
public static void main(String [] args){
- String connectionUri = "xcc://demo:demo@ec2-184-73-63-145.compute-1.amazonaws.com:8099/bakesale";
+ //String connectionUri = "xcc://admin:admin@localhost:8005/bakesale";
+ String connectionUri = "xcc://admin:admin@ec2-184-73-4-47.compute-1.amazonaws.com:8005/bakesale";
ToolMarkLogicQueryRunner cq;
try {
cq = new ToolMarkLogicQueryRunner(new URI(connectionUri));
View
1 src/com/marklogic/sparql2xquery/translator/S2XTranslator.java
@@ -99,6 +99,7 @@ public static String translateSparqlQuery(String szSparql){
printQueryInfo(query);
}
+
//Translate SPARQL Query
S2XElementVisitor translator = new com.marklogic.sparql2xquery.translator.v4.S2XElementVisitor();
translator.debug=false;

0 comments on commit 6c48115

Please sign in to comment.