marklogic / marklogic-sesame Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED Marklogic Sesame API for using MarkLogic with the Sesame RDF Framework
License: Apache License 2.0
DEPRECATED Marklogic Sesame API for using MarkLogic with the Sesame RDF Framework
License: Apache License 2.0
The design for 1.0.0 is lacking the ability to query individual collections and directories of documents. This would be a very useful feature and is available to the underlying Java Client API.
The following tests fails at "assertThat(st.getContext(), is(equalTo((Resource)dirgraph1)));" , the context returned by st.getContext() is null always.
@test
public void testGetStatementsInMultipleContexts()
throws Exception
{
testAdminCon.begin();
testAdminCon.add(micah, lname, micahlname, dirgraph1);
testAdminCon.add(micah, fname, micahfname, dirgraph1);
testAdminCon.add(micah, homeTel, micahhomeTel, dirgraph1);
testAdminCon.commit();
CloseableIteration<? extends Statement, RepositoryException> iter = testAdminCon.getStatements(null, null, null, false, dirgraph1);
try {
int count = 0;
while (iter.hasNext()) {
count++;
Statement st = iter.next();
logger.debug("Test 1" +st.getContext());
logger.debug("Test 1" +st.getObject().stringValue());
assertThat(st.getContext(), is(equalTo((Resource)dirgraph1)));
}
assertEquals("there should be three statements", 3, count);
}
finally {
iter.close();
iter = null;
}
When inserting triples using the method "add(Resource subject, URI predicate, Value object, Resource... contexts)", the object "Alice", gets inserted into the database as a URI and not as String "Alice". The query below returns empty dataset. As a result of this , email data gets inserted but when running size() method, RDFParseException is thrown as it complains the an email (for example '[email protected]) is not a valid URI format.
SELECT ?o
FROM http://marklogic.com/test/context5
WHERE
{
?s ?p ?o.
FILTER (?o = "Alice")
}
Sample code:
Resource context5 = testAdminCon.getValueFactory().createURI("http://marklogic.com/test/context5");
URI alice = testAdminCon.getValueFactory().createURI("http://example.org/people/alice");
URI name = testAdminCon.getValueFactory().createURI("http://example.org/ontology/name");
URI person = testAdminCon.getValueFactory().createURI("http://example.org/ontology/Person");
Literal alicesName = testAdminCon.getValueFactory().createLiteral("Alice");
testAdminCon.add(alice, RDF.TYPE, person,context5);
testAdminCon.add(alice, name, alicesName,context5);
testAdminCon.hasStatement(john, homeTel, johnhomeTel, false) generates the following ASK query which is incorrect syntactically. This occurs only when the context is not specified or if one of the context is explicitly specified as null.
Scenarios:
ASK { http://marklogicsparql.com/id#1111 http://marklogicsparql.com/addressbook#homeTel "1.11111111E8"@http://www.w3.org/2001/xmlschema#double }
org.openrdf.repository.RepositoryException: org.openrdf.query.QueryEvaluationException: Local message: failed to apply resource at /graphs/sparql: Bad Request. Server Message: XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected , expecting }
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.hasStatement(MarkLogicRepositoryConnection.java:348)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testGetStatementsInSingleContext(MarkLogicRepositoryConnectionTest.java:1642)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.openrdf.query.QueryEvaluationException: Local message: failed to apply resource at /graphs/sparql: Bad Request. Server Message: XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected , expecting }
at com.marklogic.semantics.sesame.query.MarkLogicBooleanQuery.evaluate(MarkLogicBooleanQuery.java:59)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.hasStatement(MarkLogicRepositoryConnection.java:342)
... 27 more
Caused by: com.marklogic.client.FailedRequestException: Local message: failed to apply resource at /graphs/sparql: Bad Request. Server Message: XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected , expecting }
at com.marklogic.client.impl.JerseyServices.checkStatus(JerseyServices.java:4598)
at com.marklogic.client.impl.JerseyServices.postResource(JerseyServices.java:3492)
at com.marklogic.client.impl.JerseyServices.executeSparql(JerseyServices.java:5606)
at com.marklogic.client.impl.SPARQLQueryManagerImpl.executeQueryImpl(SPARQLQueryManagerImpl.java:101)
at com.marklogic.client.impl.SPARQLQueryManagerImpl.executeQueryImpl(SPARQLQueryManagerImpl.java:94)
at com.marklogic.client.impl.SPARQLQueryManagerImpl.executeAsk(SPARQLQueryManagerImpl.java:140)
at com.marklogic.semantics.sesame.client.MarkLogicClientImpl.performBooleanQuery(MarkLogicClientImpl.java:225)
at com.marklogic.semantics.sesame.client.MarkLogicClient.sendBooleanQuery(MarkLogicClient.java:125)
at com.marklogic.semantics.sesame.query.MarkLogicBooleanQuery.evaluate(MarkLogicBooleanQuery.java:51)
... 28 more
The method con.prepareTupleQuery(String query, String baseuri), con.prepareBooleanQuery(Stirng query, String baseuri) etc are missing
On evaluating the query obtained by prepareGraphQuery and prepareUpdateQuery method when used with a baseuri doesn't give the correct result and always returns empty result set.
Sesame's org.openrdf.model.impl.URI (and undelrying org.openrdf.model.impl.URIImpl) strictly check URI's. In MarkLogic, URI are constrained as xs:string so its possible to generate URI (ex. graph names)that Sesame classes (derived or otherwise) will choke on.
Investigate what chicanery might be required to bypass this limitation and table discussion to broader group.
Statement st1 = vf.createStatement(john, fname, johnfname);
con.add(st1,dirgraph);
java.lang.NullPointerException
at com.marklogic.semantics.sesame.client.MarkLogicClientImpl.performAdd(MarkLogicClientImpl.java:273)
at com.marklogic.semantics.sesame.client.MarkLogicClient.sendAdd(MarkLogicClient.java:145)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.add(MarkLogicRepositoryConnection.java:448)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testPrepareTupleQuery3(MarkLogicRepositoryConnectionTest.java:518)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
con.size(context) returns the number of triples in the entire database and not of the specified graph
Able to create a null MarkLogic client object with the default construtor MarkLogicRepository().
We should throw an error and/or provide more handling.
The following code fails when 'context' is not set as it looks like it is not handled in 'performAdd' method in 'MarkLogicClientImpl' class
//testAdminCon is an instance of RepositoryConnection
InputStream in = MarkLogicRepositoryConnectionTest.class.getResourceAsStream(TEST_DIR_PREFIX
+ "directory.ttl");
testAdminCon.add(in, "", RDFFormat.TURTLE);
When the result set from a query execution is empty, an exception is thrown when referencing the hasNext() method. The exception stack trace is as follows:
org.openrdf.query.QueryEvaluationException: org.openrdf.rio.RDFParseException: Expected '<' or '', found: { [line 1]
at org.openrdf.http.client.QueueCursor.checkException(QueueCursor.java:170)
at org.openrdf.http.client.QueueCursor.getNextElement(QueueCursor.java:125)
at info.aduna.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:91)
at info.aduna.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:60)
at org.openrdf.http.client.BackgroundGraphResult.hasNext(BackgroundGraphResult.java:81)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testPrepareGraphQuery1(MarkLogicRepositoryConnectionTest.java:750)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.openrdf.rio.RDFParseException: Expected '<' or '', found: { [line 1]
at org.openrdf.rio.helpers.RDFParserHelper.reportFatalError(RDFParserHelper.java:440)
at org.openrdf.rio.helpers.RDFParserBase.reportFatalError(RDFParserBase.java:704)
at org.openrdf.rio.ntriples.NTriplesParser.reportFatalError(NTriplesParser.java:674)
at org.openrdf.rio.ntriples.NTriplesParser.parseSubject(NTriplesParser.java:369)
at org.openrdf.rio.ntriples.NTriplesParser.parseTriple(NTriplesParser.java:301)
at org.openrdf.rio.ntriples.NTriplesParser.parse(NTriplesParser.java:192)
at org.openrdf.http.client.BackgroundGraphResult.run(BackgroundGraphResult.java:124)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
The exception stack trace seen below is thrown and not RDFParseException when adding malformed turtle file
com.marklogic.client.FailedRequestException: Local message: failed to apply resource at graphs: Internal Server Error. Server Message: XDMP-DOCBADCHAR: xdmp:turtle($body, $options) -- Unexpected character found: '_' (0x005f) at :6:26 . See the MarkLogic server error log for further detail.
at com.marklogic.client.impl.JerseyServices.checkStatus(JerseyServices.java:4600)
at com.marklogic.client.impl.JerseyServices.postResource(JerseyServices.java:3494)
at com.marklogic.client.impl.JerseyServices.mergeGraph(JerseyServices.java:5429)
at com.marklogic.client.impl.GraphManagerImpl.merge(GraphManagerImpl.java:207)
at com.marklogic.client.impl.GraphManagerImpl.merge(GraphManagerImpl.java:193)
at com.marklogic.semantics.sesame.client.MarkLogicClientImpl.performAdd(MarkLogicClientImpl.java:246)
at com.marklogic.semantics.sesame.client.MarkLogicClient.sendAdd(MarkLogicClient.java:138)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.add(MarkLogicRepositoryConnection.java:500)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testAddMalformedLiteralsDefaultConfig(MarkLogicRepositoryConnectionTest.java:1207)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
The method connection.clear() , I think without arguments is supposed to clear all the contents of the database which doesn’t happen. But connection.clear(context) clears the specified graph.
con.size() on an empty database and with no arguments throws the following exception
org.openrdf.repository.RepositoryException: org.openrdf.query.QueryEvaluationException: org.openrdf.rio.RDFParseException: Expected '<' or '', found: { [line 1]
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection$4.convert(MarkLogicRepositoryConnection.java:262)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection$4.convert(MarkLogicRepositoryConnection.java:1)
at info.aduna.iteration.ExceptionConvertingIteration.hasNext(ExceptionConvertingIteration.java:81)
at org.openrdf.repository.RepositoryResult.hasNext(RepositoryResult.java:66)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.size(MarkLogicRepositoryConnection.java:306)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.createRepository(MarkLogicRepositoryConnectionTest.java:217)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.setUp(MarkLogicRepositoryConnectionTest.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.openrdf.query.QueryEvaluationException: org.openrdf.rio.RDFParseException: Expected '<' or '', found: { [line 1]
at org.openrdf.http.client.QueueCursor.checkException(QueueCursor.java:170)
at org.openrdf.http.client.QueueCursor.getNextElement(QueueCursor.java:125)
at info.aduna.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:91)
at info.aduna.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:60)
at org.openrdf.http.client.BackgroundGraphResult.hasNext(BackgroundGraphResult.java:81)
at info.aduna.iteration.ExceptionConvertingIteration.hasNext(ExceptionConvertingIteration.java:78)
... 29 more
Caused by: org.openrdf.rio.RDFParseException: Expected '<' or '_', found: { [line 1]
at org.openrdf.rio.helpers.RDFParserHelper.reportFatalError(RDFParserHelper.java:440)
at org.openrdf.rio.helpers.RDFParserBase.reportFatalError(RDFParserBase.java:704)
at org.openrdf.rio.ntriples.NTriplesParser.reportFatalError(NTriplesParser.java:674)
at org.openrdf.rio.ntriples.NTriplesParser.parseSubject(NTriplesParser.java:369)
at org.openrdf.rio.ntriples.NTriplesParser.parseTriple(NTriplesParser.java:301)
at org.openrdf.rio.ntriples.NTriplesParser.parse(NTriplesParser.java:192)
at org.openrdf.http.client.BackgroundGraphResult.run(BackgroundGraphResult.java:124)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Whenever a file URI is being used to load in data and no Base URI has been defined we (sh/c)ould use the file uri as default Base URI.
currently you can instantiate a repository without fully detailing out all required ml client connection details ... should throw an error
autocommit has a number of dark corners, need to ensure we have these enumerated and addressed
con.remove(statement) fails with a following exception stack trace
The same behavior is seen for con.remove(statement, context) as well
java.lang.NullPointerException
at com.marklogic.semantics.sesame.client.MarkLogicClientImpl.performRemove(MarkLogicClientImpl.java:301)
at com.marklogic.semantics.sesame.client.MarkLogicClient.sendRemove(MarkLogicClient.java:150)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.remove(MarkLogicRepositoryConnection.java:474)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testInsertRemove(MarkLogicRepositoryConnectionTest.java:948)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
The method con.prepareQuery() throws UnsupportedOperationException for non SPARQL language instead of UnsupportedQueryLanguageException. Other prepare methods throw the correct exception
I am creating a case for this question so that we don't lose track of it.
Sesame doesn't allow creation of URI unless the character ':' is present in the uri string (org.openrdf.model.impl.URIImpl) . Marklogic does allow creation of contexts without ":". So, can this pose a problem in that all the graphs created through any other methods in MarkLogic should essentially have ':' so that they can be used within Sesame ?
At this point, it looks like we don't have a way of setting default ruleset(s) for the database from within marklogic-sesame in the MarkLogicRepositoryConnection class. Something like
public void setRulesets(SPARQLRuleset ruleset...)
public SPARQLRuleset [] getRulesets()
I assume that in the method "public RepositoryResult getStatements(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts)", when includeInferred is set to true, it applies the default rule set on the triples and returns the statements. But there doesn't seem to be a way to set default ruleset(s) as of now.
need to build out export
con.size(null) should provide the number of triples without context. But it throws the following exception.
java.lang.NullPointerException
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.size(MarkLogicRepositoryConnection.java:419)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testGetStatementsInSingleContext(MarkLogicRepositoryConnectionTest.java:1434)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
con.remove(uri, uri, null ) fails (when object is a null object ) with the following exception stack trace
java.lang.NullPointerException
at com.marklogic.semantics.sesame.client.MarkLogicClientImpl.performRemove(MarkLogicClientImpl.java:291)
at com.marklogic.semantics.sesame.client.MarkLogicClient.sendRemove(MarkLogicClient.java:150)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.remove(MarkLogicRepositoryConnection.java:542)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testRemoveStatements(MarkLogicRepositoryConnectionTest.java:1166)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
CloseableIteration<? extends Statement, RepositoryException> iter = testAdminCon.getStatements(null, null,null, false, null, dirgraph1);
throws a null pointer exception when one of the context specified is null
Adding triples of format ntriples fails with exception.
con.add(MarkLogicRepositoryConnectionTest.class.getResourceAsStream( "family-tree.nt"), "", RDFFormat.NTRIPLES, dirgraph);
com.marklogic.client.FailedRequestException: Local message: failed to apply resource at graphs: Internal Server Error. Server Message: XDMP-DOCBADCHAR: xdmp:nquad($body, $options) -- Unexpected character found: '' (0xfeff) at :1:0 . See the MarkLogic server error log for further detail.
at com.marklogic.client.impl.JerseyServices.checkStatus(JerseyServices.java:4600)
at com.marklogic.client.impl.JerseyServices.postResource(JerseyServices.java:3494)
at com.marklogic.client.impl.JerseyServices.mergeGraph(JerseyServices.java:5429)
at com.marklogic.client.impl.GraphManagerImpl.merge(GraphManagerImpl.java:207)
at com.marklogic.client.impl.GraphManagerImpl.merge(GraphManagerImpl.java:193)
at com.marklogic.semantics.sesame.client.MarkLogicClientImpl.performAdd(MarkLogicClientImpl.java:244)
at com.marklogic.semantics.sesame.client.MarkLogicClient.sendAdd(MarkLogicClient.java:138)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.add(MarkLogicRepositoryConnection.java:500)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testPrepareQuery1(MarkLogicRepositoryConnectionTest.java:1074)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Sam's fix in java client regarding pagination seems to have broken 'MarkLogicClientimpl.java'
java.lang.Error: Unresolved compilation problem:
The method executeSelect(SPARQLQueryDefinition, T, long, Transaction) in the type SPARQLQueryManager is not applicable for the arguments (SPARQLQueryDefinition, InputStreamHandle, long, long, Transaction)
at com.marklogic.semantics.sesame.client.MarkLogicClientImpl.performSPARQLQuery(MarkLogicClientImpl.java:178)
at com.marklogic.semantics.sesame.client.MarkLogicClientImpl.performSPARQLQuery(MarkLogicClientImpl.java:159)
at com.marklogic.semantics.sesame.client.MarkLogicClient.sendTupleQuery(MarkLogicClient.java:92)
at com.marklogic.semantics.sesame.query.MarkLogicTupleQuery.evaluate(MarkLogicTupleQuery.java:55)
at com.marklogic.semantics.sesame.query.MarkLogicTupleQuery.evaluate(MarkLogicTupleQuery.java:50)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.getStatements(MarkLogicRepositoryConnection.java:269)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.size(MarkLogicRepositoryConnection.java:419)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.isEmpty(MarkLogicRepositoryConnection.java:445)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testAddDeleteInsert(MarkLogicRepositoryConnectionTest.java:1281)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
example subproject should be updated to;
The following test fails at "assertEquals("there should be three statements", 3, count);". The returned value of count is zero.
@test
public void testGetStatementsInMultipleContexts()
throws Exception
{
testAdminCon.getStatements(null, homeTel, null, false);
testAdminCon.begin();
testAdminCon.add(micah, lname, micahlname, dirgraph1);
testAdminCon.add(micah, fname, micahfname, dirgraph1);
testAdminCon.add(micah, homeTel, micahhomeTel, dirgraph1);
testAdminCon.commit();
CloseableIteration<? extends Statement, RepositoryException> iter = testAdminCon.getStatements(null, null, null, false, dirgraph1, dirgraph);
try {
int count = 0;
while (iter.hasNext()) {
count++;
Statement st = iter.next();
logger.debug("Test 2" +st.getContext());
logger.debug("Test 2" +st.getObject().stringValue());
// we should have only statements from context2
assertThat(st.getContext(), is(equalTo((Resource)dirgraph1)));
}
assertEquals("there should be three statements", 3, count);
}
finally {
iter.close();
iter = null;
}
}
Query :
"PREFIX demor: http://demo/resource#
PREFIX demov: http://demo/verb#
PREFIX vcard: http://www.w3.org/2006/vcard/ns#
SELECT (COUNT(?company) AS ?total)
WHERE {
?company a vcard:Organization .
?company demov:industry ?industry .
?company vcard:hasAddress/vcard:postal-code ?zip .
?company vcard:hasAddress/vcard:postal-code ?whatcode
}",
the expected output is "12"^^http://www.w3.org/2001/XMLSchema#unsignedLong but a <12> is returned. I assume this would be the case for other aggregate functions as well and also for all datatypes of data used within the aggregate function
Exception:
java.lang.AssertionError: expected:<"12"^^http://www.w3.org/2001/XMLSchema#unsignedLong> but was:<12>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:118)
at org.junit.Assert.assertEquals(Assert.java:144)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testPrepareQuery1(MarkLogicRepositoryConnectionTest.java:1621)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
NullPointerException thrown when context is mentioned as null . It inserts fine into default graph when no argument is provided.
testAdminCon.add(ir, "", RDFFormat.TURTLE,null);
java.lang.NullPointerException
at com.marklogic.semantics.sesame.client.MarkLogicClientImpl.performAdd(MarkLogicClientImpl.java:243)
at com.marklogic.semantics.sesame.client.MarkLogicClient.sendAdd(MarkLogicClient.java:142)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.add(MarkLogicRepositoryConnection.java:508)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testPrepareQuery2(MarkLogicRepositoryConnectionTest.java:1636)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
con.size() is expected to return the number of triples in the entire db (triples with or without contexts). But the result returned is incorrect. Upon checking 'MarkLogicTupleQuery.java', the value of pagelength has been hardcoded to 50 and all select queries now return only a maximum of 50 results.
The following triple is inserted into db. The Xquery version runs and provides “true” which is expected whereas the method in Sesame returns false. I just want to be sure if the Xquery and java method are meant to have the same functionality. If so, then this might be an issue.
sem:triple
sem:subject
http://marklogic.com/baseball/players#119
/sem:subject
sem:predicate
http://marklogic.com/baseball/players#team
/sem:predicate
sem:object
http://marklogic.com/baseball/rules#Tigers
/sem:object
/sem:triple
XQuery:
xquery version "1.0-ml";
import module namespace sem = "http://marklogic.com/semantics" at "MarkLogic/semantics.xqy";
let $query := '
PREFIX bb: http://marklogic.com/baseball/players#
ASK FROM http://marklogic.com/Graph1
WHERE
{
<players#119> <players#team> <rules#Tigers>.
}
'
let $boolean := sem:sparql($query, (), "base=http://marklogic.com/baseball/")
return $boolean
Sesame:
String query1 = "PREFIX bb: http://marklogic.com/baseball/players#"+
" ASK FROM http://marklogic.com/Graph1"+
" WHERE"+
" {"+
" <players#119> <players#team> <rules#Tigers>."+
" }";
boolean result1 = testAdminCon.prepareBooleanQuery(QueryLanguage.SPARQL, query1,"http://marklogic.com/baseball/").evaluate();
This bug tracks all the scenarios where the exceptions thrown in marklogic-sesame are not the ones specified in the spec but rather the one thrown by the ML client.
In MarkLogicRepositoryConnection.java, each of the below prepareQuery methods call prepareTupleQuery instead of the method " public MarkLogicQuery prepareQuery(QueryLanguage queryLanguage, String queryString, String baseURI)".
Also the returned instance of type 'Query' or 'MarkLogicQuery' is not executable (as in no execute() method unlike instances of TupleQuery etc)
// prepareQuery entrypoint
@OverRide
public Query prepareQuery(String queryString) throws RepositoryException, MalformedQueryException {
return prepareTupleQuery(QueryLanguage.SPARQL, queryString, null);
}
@OverRide
public Query prepareQuery(String queryString, String baseURI) throws RepositoryException, MalformedQueryException {
return prepareTupleQuery(QueryLanguage.SPARQL, queryString, baseURI);
}
@OverRide
public Query prepareQuery(QueryLanguage queryLanguage, String queryString) throws RepositoryException, MalformedQueryException {
return prepareTupleQuery(queryLanguage, queryString, null);
}
Sesame supports adding zip and gzip files using add(InputStream in, String baseURI, RDFFormat dataFormat, Resource... contexts) method. Are we planning on supporting them as well ?
Better write performance is achieved using an internal write cache, which batches up and periodically flushes statements to ML. For symmetry we already provide a BackgroundResults cache for reading from SPARQL results.
As per Sesame, when ‘null’ is explicitly specified as context in getStatement(), it returns the statements that don’t have a context associated with it . I believe that this is the case for con.size() as well. The following snippet is from a test case for Sesame project.
// get statements with either no context or context2
CloseableIteration<? extends Statement, RepositoryException> iter = testCon.getStatements(null, null, null, false, null, context2);
The following tests fails in the final assert (Assert.assertEquals(0L,testAdminCon.size())) which is expected to succeed as the con.remove(Iteration itr) is expected to remove the entire contents of the db
@Test
public void testRemoveStatementIteration()
throws Exception
{
testAdminCon.begin();
testAdminCon.add(fei, fname, feifname, dirgraph);
testAdminCon.add(fei, lname, feilname, dirgraph);
testAdminCon.add(fei, email, feiemail, dirgraph);
testAdminCon.commit();
Assert.assertEquals(3L,testAdminCon.size());
Iteration<? extends Statement, RepositoryException> iter = testAdminCon.getStatements(null, null,
null, false);
testAdminCon.remove(iter);
Assert.assertEquals(0L,testAdminCon.size());
}
When subject, predicate or object is null in con.add(Statement st, Context ct) and con.add(Resource r, URI u, Value v) , a null pointer exception is thrown. Just wanted to check if we may want to handle it better may be wrap the exception along with a more clearer message
java.lang.NullPointerException
at com.marklogic.semantics.sesame.client.MarkLogicClientImpl.performAdd(MarkLogicClientImpl.java:263)
at com.marklogic.semantics.sesame.client.MarkLogicClient.sendAdd(MarkLogicClient.java:145)
at com.marklogic.semantics.sesame.MarkLogicRepositoryConnection.add(MarkLogicRepositoryConnection.java:521)
at com.marklogic.sesame.functionaltests.MarkLogicRepositoryConnectionTest.testPrepareTupleQuery1(MarkLogicRepositoryConnectionTest.java:403)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
The triples inserted from query console are not returned using 'SELECT' query from within Sesame.
Steps:
returns the size as zero. The query executed from Sesame is "SELECT * WHERE { GRAPH http://abcd {?s ?p ?o .} }" returns an empty result set but which as expected returns the result set when run from Query console.
Statement st = vf.createStatement(john, lname, johnlname, dirgraph);
testAdminCon.add(st);
Assert.assertTrue(testAdminCon.hasStatement(st, false, dirgraph));
The code above generates a query which misses the graph name and also is of incorrect syntax.
ASK { http://marklogicsparql.com/id#1111 http://marklogicsparql.com/addressbook#email "[email protected]"@http://www.w3.org/2001/xmlschema#string }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.