Update query in Neo4j 2.2.3 error - neo4j

We have a query that updates relationship props :
MATCH (body_id:BodyId{body_id : 126414})<-[to_body_id:TO_BODY_ID{end : 99999999999999}]-(body:Body)
-[body_to_target:BODY_TO_TARGET{end : 99999999999999}]-(target:Target)
-[to_target_id:TO_TARGET_ID{end : 99999999999999}]->(target_id:TargetId{target_id : 126414})
WHERE ((id(body) = 28888220))
with body_to_target
SET body_to_target.start = 1434535407147
And sometimes we get this error:
Neo.DatabaseError.Statement.ExecutionFailure: java.lang.Long cannot be
cast to org.neo4j.index.impl.lucene.RelationshipId
A piece of stack when running from Java:
Caused by: java.lang.RuntimeException: Error executing cypher statement(s) [{code=Neo.DatabaseError.Statement.ExecutionFailure, message=java.lang.Long cannot be cast to org.neo4j.index.impl.lucene.RelationshipId, stackTrace=java.lang.ClassCastException: java.lang.Long cannot be cast to org.neo4j.index.impl.lucene.RelationshipId
at org.neo4j.index.impl.lucene.RelationshipId.equals(RelationshipId.java:43)
at java.util.HashMap.removeNode(HashMap.java:819)
at java.util.HashMap.remove(HashMap.java:798)
at java.util.HashSet.remove(HashSet.java:235)
at org.neo4j.index.impl.lucene.ExactTxData.remove(ExactTxData.java:158)
at org.neo4j.index.impl.lucene.TxDataHolder.remove(TxDataHolder.java:48)
at org.neo4j.index.impl.lucene.LuceneTransactionState.insert(LuceneTransactionState.java:86)
at org.neo4j.index.impl.lucene.LuceneTransactionState.add(LuceneTransactionState.java:41)
at org.neo4j.index.impl.lucene.LuceneIndex$RelationshipIndex.addRelationship(LuceneIndex.java:452)
at org.neo4j.kernel.impl.api.StateHandlingStatementOperations$3.visit(StateHandlingStatementOperations.java:1379)
at org.neo4j.kernel.impl.api.store.CacheLayer.relationshipVisit(CacheLayer.java:489)
at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.relationshipVisit(StateHandlingStatementOperations.java:1238)
at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.relationshipAddToLegacyIndex(StateHandlingStatementOperations.java:1373)
at org.neo4j.kernel.impl.api.OperationsFacade.relationshipAddToLegacyIndex(OperationsFacade.java:881)
at org.neo4j.kernel.impl.coreapi.LegacyIndexProxy$Type$2.add(LegacyIndexProxy.java:169)
at org.neo4j.kernel.impl.coreapi.LegacyIndexProxy.internalAdd(LegacyIndexProxy.java:517)
at org.neo4j.kernel.impl.coreapi.LegacyIndexProxy.add(LegacyIndexProxy.java:383)
at org.neo4j.kernel.impl.coreapi.AbstractAutoIndexerImpl.propertyChanged(AbstractAutoIndexerImpl.java:70)
at org.neo4j.kernel.impl.api.LegacyPropertyTrackers.relationshipChangeStoreProperty(LegacyPropertyTrackers.java:98)
at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.relationshipSetProperty(StateHandlingStatementOperations.java:648)
at org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.relationshipSetProperty(ConstraintEnforcingEntityOperations.java:171)
at org.neo4j.kernel.impl.api.LockingStatementOperations.relationshipSetProperty(LockingStatementOperations.java:340)
at org.neo4j.kernel.impl.api.OperationsFacade.relationshipSetProperty(OperationsFacade.java:665)
at org.neo4j.cypher.internal.spi.v2_2.TransactionBoundQueryContext$RelationshipOperations.setProperty(TransactionBoundQueryContext.scala:216)
at org.neo4j.cypher.internal.compiler.v2_2.spi.DelegatingOperations.setProperty(DelegatingQueryContext.scala:126)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.org$neo4j$cypher$internal$compatibility$ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$super$setProperty(ExceptionTranslatingQueryContext.scala:151)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$setProperty$1.apply$mcV$sp(ExceptionTranslatingQueryContext.scala:151)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$setProperty$1.apply(ExceptionTranslatingQueryContext.scala:151)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$setProperty$1.apply(ExceptionTranslatingQueryContext.scala:151)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext.org$neo4j$cypher$internal$compatibility$ExceptionTranslatingQueryContext$$translateException(ExceptionTranslatingQueryContext.scala:182)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.setProperty(ExceptionTranslatingQueryContext.scala:151)
at org.neo4j.cypher.internal.compiler.v2_2.spi.UpdateCountingQueryContext$CountingOps.setProperty(UpdateCountingQueryContext.scala:132)
at org.neo4j.cypher.internal.compiler.v2_2.mutation.PropertySetAction.exec(PropertySetAction.scala:52)
at org.neo4j.cypher.internal.compiler.v2_2.pipes.ExecuteUpdateCommandsPipe.org$neo4j$cypher$internal$compiler$v2_2$pipes$ExecuteUpdateCommandsPipe$$exec(ExecuteUpdateCommandsPipe.scala:56)
at org.neo4j.cypher.internal.compiler.v2_2.pipes.ExecuteUpdateCommandsPi$$$$3fd0ddfab96df657454927b510aaae$$$$ands$1$$anonfun$apply$2.apply(ExecuteUpdateCommandsPipe.scala:45)
at org.neo4j.cypher.internal.compiler.v2_2.pipes.ExecuteUpdateCommandsPi$$$$3fd0ddfab96df657454927b510aaae$$$$ands$1$$anonfun$apply$2.apply(ExecuteUpdateCommandsPipe.scala:45)
at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)
at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)
at org.neo4j.cypher.internal.compiler.v2_2.pipes.EmptyResultPipe.internalCreateResults(EmptyResultPipe.scala:29)
at org.neo4j.cypher.internal.compiler.v2_2.pipes.PipeWithSource.createResults(Pipe.scala:122)
at org.neo4j.cypher.internal.compiler.v2_2.executionplan.DefaultExecutionResultBuilderFactory$ExecutionWorkflowBuilder.createResults(DefaultExecutionResultBuilderFactory.scala:92)
at org.neo4j.cypher.internal.compiler.v2_2.executionplan.DefaultExecutionResultBuilderFactory$ExecutionWorkflowBuilder.build(DefaultExecutionResultBuilderFactory.scala:64)
at org.neo4j.cypher.internal.compiler.v2_2.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:121)
at org.neo4j.cypher.internal.compiler.v2_2.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:105)
at org.neo4j.cypher.internal.compiler.v2_2.executionplan.ExecutionPlanBuilder$$anon$1.run(ExecutionPlanBuilder.scala:69)
at org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2$ExecutionPlanWrapper$$anonfun$run$1.apply(CompatibilityFor2_2.scala:173)
at org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2$ExecutionPlanWrapper$$anonfun$run$1.apply(CompatibilityFor2_2.scala:173)
at org.neo4j.cypher.internal.compatibility.exceptionHandlerFor2_2$.runSafely(CompatibilityFor2_2.scala:105)
at org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2$ExecutionPlanWrapper.run(CompatibilityFor2_2.scala:172)
at org.neo4j.cypher.internal.PreparedPlanExecution.execute(PreparedPlanExecution.scala:28)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:108)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:102)
at org.neo4j.cypher.javacompat.internal.ServerExecutionEngine.executeQuery(ServerExecutionEngine.java:61)
at org.neo4j.server.rest.transactional.TransactionHandle.executeStatements(TransactionHandle.java:327)
at org.neo4j.server.rest.transactional.TransactionHandle.execute(TransactionHandle.java:258)
at org.neo4j.server.rest.transactional.TransactionHandle.execute(TransactionHandle.java:103)
at org.neo4j.server.rest.web.TransactionalService$1.write(TransactionalService.java:192)
at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:71)
at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:57)
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:302)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1510)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:800)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:620)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:540)
at java.lang.Thread.run(Thread.java:745)
}]
at org.neo4j.jdbc.rest.StreamingParser.handleErrors(StreamingParser.java:359)
at org.neo4j.jdbc.rest.StreamingParser.skipTo(StreamingParser.java:333)
at org.neo4j.jdbc.rest.StreamingParser.nextResult(StreamingParser.java:148)
at org.neo4j.jdbc.rest.StreamingParser$2.hasNext(StreamingParser.java:283)
at org.neo4j.jdbc.rest.TransactionalQueryExecutor.executeQuery(TransactionalQueryExecutor.java:209)
at org.neo4j.jdbc.Neo4jConnection.executeQuery(Neo4jConnection.java:388)
... 8 more
How can we solve this

Related

Xtext: quickfix give an ConcurrentModificationException Exception

Writing a quickfix routing using the semantic model to fix and error, a ConcurrentModificationException is created:
org.eclipse.emf.common.util.WrappedException: java.util.ConcurrentModificationException
at org.eclipse.xtext.ui.editor.quickfix.IssueResolution.apply(IssueResolution.java:78)
at org.eclipse.xtext.ui.editor.quickfix.QuickAssistCompletionProposal.apply(QuickAssistCompletionProposal.java:36)
...
The method implemented:
#Fix(DslValidator.INVALID_NORMALISED_FLOW)
def fixNormalised_ParameterDeclarations(Issue issue, IssueResolutionAcceptor acceptor) {
acceptor.accept(issue, 'Normalize the parameters', 'Capitalize the name.', 'upcase.png') [ element, context |
var param = element as ParameterDeclarations
//var index_s = issue.data // index provided from the validator
var index = 1 // dummy index
for (name : param.declare.get(index).identifier) {
param.declare.get(index - 1).identifier.add(name)
}
param.declare.drop(index)
]
}
The input syntax look like a:int, b:int and must be converted to a, b:int where
ParameterDeclarations:
(
declare+=VariableDeclare
(',' declare+=VariableDeclare)*
) | (
connection=ConnectionName
) | (
not_connected?='void'?
);
VariableDeclare:
identifier+=VariableName (',' identifier+=VariableName)* ':' type=Type;
In the syntax a and b are instances of VariableName and int of Type.
How do I resolve the exception?
Updates:
Stack trace:
eclipse.buildId=4.7.3.M20180301-0715
java.version=1.8.0_161
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_ZA
Framework arguments: -product org.eclipse.platform.ide
Command-line arguments: -product org.eclipse.platform.ide -data /home/johan/workspace/sofl_dsl_2018_April/../runtime-EclipseXtext -dev file:/home/johan/workspace/sofl_dsl_2018_April/.metadata/.plugins /org.eclipse.pde.core/Launch Runtime Eclipse/dev.properties -os linux -ws gtk -arch x86_64
org.eclipse.ui
Error
Sun Apr 08 18:29:26 SAST 2018
Unhandled event loop exception
org.eclipse.emf.common.util.WrappedException: java.util.ConcurrentModificationException
at org.eclipse.xtext.ui.editor.quickfix.IssueResolution.apply(IssueResolution.java:78)
at org.eclipse.xtext.ui.editor.quickfix.QuickAssistCompletionProposal.apply(QuickAssistCompletionProposal.java:36)
at org.eclipse.xtext.ui.editor.hover.AnnotationWithQuickFixesHover$AnnotationInformationControl.apply(AnnotationWithQuickFixesHover.java:536)
at org.eclipse.xtext.ui.editor.hover.AnnotationWithQuickFixesHover$AnnotationInformationControl.access$2(AnnotationWithQuickFixesHover.java:513)
at org.eclipse.xtext.ui.editor.hover.AnnotationWithQuickFixesHover$AnnotationInformationControl$5.widgetSelected(AnnotationWithQuickFixesHover.java:507)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5348)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374)
at org.eclipse.swt.widgets.Widget.sendSelectionEvent(Widget.java:1488)
at org.eclipse.swt.widgets.Link.gtk_button_release_event(Link.java:384)
at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1957)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:6193)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5608)
at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9282)
at org.eclipse.swt.widgets.Display.eventProc(Display.java:1328)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2116)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4181)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
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:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Caused by: java.util.ConcurrentModificationException
at org.eclipse.emf.common.util.AbstractEList$EIterator.checkModCount(AbstractEList.java:760)
at org.eclipse.emf.common.util.AbstractEList$EIterator.doNext(AbstractEList.java:714)
at org.eclipse.emf.common.util.AbstractEList$EIterator.next(AbstractEList.java:694)
at tuks.sofl.ui.quickfix.DslQuickfixProvider.lambda$0(DslQuickfixProvider.java:41)
at org.eclipse.xtext.ui.editor.model.edit.SemanticModificationWrapper$1.process(SemanticModificationWrapper.java:36)
at org.eclipse.xtext.ui.editor.model.edit.SemanticModificationWrapper$1.process(SemanticModificationWrapper.java:1)
at org.eclipse.xtext.util.concurrent.IUnitOfWork$Void.exec(IUnitOfWork.java:37)
at org.eclipse.xtext.ui.editor.model.edit.ReconcilingUnitOfWork.exec(ReconcilingUnitOfWork.java:56)
at org.eclipse.xtext.ui.editor.model.edit.ReconcilingUnitOfWork.exec(ReconcilingUnitOfWork.java:1)
at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:91)
at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.modify(XtextDocument.java:428)
at org.eclipse.xtext.ui.editor.model.XtextDocument.internalModify(XtextDocument.java:162)
at org.eclipse.xtext.ui.editor.model.XtextDocument.modify(XtextDocument.java:155)
at org.eclipse.xtext.ui.editor.model.edit.SemanticModificationWrapper.apply(SemanticModificationWrapper.java:32)
at org.eclipse.xtext.ui.editor.quickfix.IssueResolution.apply(IssueResolution.java:76)
... 42 more
Making a copy of the list (the correct way) and use the right method to remove an element in a list:
#Fix(DslValidator.INVALID_NORMALISED_FLOW)
def fixNormalised_ParameterDeclarations(Issue issue, IssueResolutionAcceptor acceptor) {
acceptor.accept(issue, 'Normalize the parameters', 'Capitalize the name.', 'upcase.png') [ element, context |
var param = element as ParameterDeclarations
var index = 1 // dummy index
val copier = new EcoreUtil.Copier();
var names_to_add = copier.copyAll(param.declare.get(index).identifier)
//for (name : param.declare.get(index).identifier) {
for (name : names_to_add) {
param.declare.get(index - 1).identifier.add(name)
}
param.declare.remove(index) // Also fix here use remove and not drop
]
}

MyBatis foreach update can't see all item parameters from collection

I'm trying to use foreach loop in #Update with my mapper and unexpectedly mybatis has a problem with resolving all parameters from collection. Some details below:
#Update("<script>"
+ "<foreach collection='objects' item='item' separator=';'>"
+ "UPDATE some_table "
+ "SET field_x=#{item.x}, "
+ "field_y=#{item.y} "
+ "WHERE field_z=#{item.z} AND field_a=#{item.a}"
+ "</foreach>"
+ "</script>")
void update(#Param("objects") List<SomeObject> objects);
and:
public class SomeObject {
private String z;
private SomeEnum a;
private BigDecimal x;
private Integer y;
}
method call returned:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_item_1.dailyAmount', mode=IN, javaType=class java.math.BigDecimal, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #5 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.h2.jdbc.JdbcSQLException: Invalid value "5" for parameter "parameterIndex" [90008-196]
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at com.sun.proxy.$Proxy33.update(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy43.updateLimits(Unknown Source)
at pl.raiffeisen.ekd.blik.core.persistence.DataProvider.updateLimits(DataProvider.java:76)
at pl.raiffeisen.ekd.blik.api.rest.settings.SettingsController.updateLimits(SettingsController.java:136)
at pl.raiffeisen.ekd.blik.test.rest.SettingsControllerTest.testUpdateLimitsSuccessPath(SettingsControllerTest.java:532)
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:498)
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.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
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.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_item_1.dailyAmount', mode=IN, javaType=class java.math.BigDecimal, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #5 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.h2.jdbc.JdbcSQLException: Invalid value "5" for parameter "parameterIndex" [90008-196]
at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:89)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:93)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:64)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
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:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 38 more
Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #5 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.h2.jdbc.JdbcSQLException: Invalid value "5" for parameter "parameterIndex" [90008-196]
at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:55)
at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:87)
... 50 more
Caused by: org.h2.jdbc.JdbcSQLException: Invalid value "5" for parameter "parameterIndex" [90008-196]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.getInvalidValueException(DbException.java:228)
at org.h2.jdbc.JdbcPreparedStatement.setParameter(JdbcPreparedStatement.java:1444)
at org.h2.jdbc.JdbcPreparedStatement.setBigDecimal(JdbcPreparedStatement.java:384)
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:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:67)
at com.sun.proxy.$Proxy58.setBigDecimal(Unknown Source)
at org.apache.ibatis.type.BigDecimalTypeHandler.setNonNullParameter(BigDecimalTypeHandler.java:32)
at org.apache.ibatis.type.BigDecimalTypeHandler.setNonNullParameter(BigDecimalTypeHandler.java:27)
at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:53)
... 51 more
after debugging I saw this: (at: org.h2.jdbc.JdbcPreparedStatement:1002)
this = prep19: UPDATE some_table SET field_x=?, field_y=? WHERE field_z=? AND field_a=? ;
UPDATE transaction_limit SET field_x=?, field_y=? WHERE field_z=? AND field_a=? ;
UPDATE transaction_limit SET field_x=?, field_y=? WHERE field_z=? AND type=? ;
{1: 250.00, 2: 1, 3: 'qwerty123', 4: 'VALUE1'}
It should be something like this: (example values)
{1: 250.00, 2: 1, 3: 'qwerty123', 4: 'VALUE1',
5: 750.00, 6: 4, 7: 'qwerty123', 8: 'VALUE2',
9: 500.00, 10: 3, 11: 'qwerty123', 12: 'VALUE3'}
Could anyone tell me why there is only one object mapped from list instead of all three (passed 3 element list to method)?
I have resolved this issue. Database H2 obviously doesn't support foreach script. With PostgreSQL everything is ok.

groovy.lang.MissingMethodException: No signature of method: com.x.License.add() is applicable for argument types: (com.x.License) values

I'm using a scheduled job to retrieve the licenses every so often. When I retrieve the licenses for each license I want to add that license to a hashmap per account. In the hashmap I have an Account and a list of Licenses. For each license I try to check if there already is a list of Licenses in the hashmap, if there isn't I make a new list and that works fine. But if there is a list I try to add it to that list and that where it throws an error for some reason
licenses.each{license->
List<License> licensesPerAccount = accountLicenseMap.get(license.account)
log.info("initial licenseperaccount " + licensesPerAccount)
if(licensesPerAccount == null) {
accountLicenseMap.put(license.account, license as List<License>)
} else{
log.info("licenseperaccount in else is " + licensesPerAccount)
licensesPerAccount.push(license)
log.info("licenseperaccount now is " + licensesPerAccount)
accountLicenseMap.put(license.account, licensesPerAccount)
}
}
This is the error it throws:
ERROR 2017-12-27 10:12:59,045 grails.plugins.quartz.listeners.ExceptionPrinterJobListener - Exception occurred in job: Grails Job
org.quartz.JobExecutionException: groovy.lang.MissingMethodException: No signature of method: com.x.License.add() is applicable for argument types: (com.x.License) values: [com.x.License : 10]
Possible solutions: any(), find(com.x.License), any(groovy.lang.Closure), wait(), last(), save()
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:111)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: groovy.lang.MissingMethodException: No signature of method: com.x.License.add() is applicable for argument types: (com.x.License) values: [com.x.License : 10]
Possible solutions: any(), find(com.x.License), any(groovy.lang.Closure), wait(), last(), save()
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoMetaMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:253)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at com.x.NewLicenseJob$_execute_closure1$$EQezpeTI.doCall(NewLicenseJob.groovy:32)
at sun.reflect.GeneratedMethodAccessor629.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springsource.loaded.ri.ReloadedTypeInvoker$2.invoke(ReloadedTypeInvoker.java:133)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1461)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021)
at groovy.lang.Closure.call(Closure.java:426)
at com.x.NewLicenseJob$_execute_closure1.call(NewLicenseJob.groovy)
at groovy.lang.Closure.call(Closure.java:442)
at com.x.NewLicenseJob$_execute_closure1.call(NewLicenseJob.groovy)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2056)
at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at com.x.NewLicenseJob$$EQezpeT2.execute(NewLicenseJob.groovy:25)
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:497)
at org.springsource.loaded.ri.ReloadedTypeInvoker$2.invoke(ReloadedTypeInvoker.java:133)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1461)
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:104)
... 2 common frames omitted
And this is what it logs:
INFO 2017-12-27 10:12:59,029 grails.app.jobs.com.x.NewLicenseJob - initial licenseperaccount null
Hibernate: select account0_.id as id1_4_0_, account0_.approve_hours_by_manager as approve_2_4_0_, account0_.brand_id as brand_id3_4_0_, account0_.check_tags as check_ta4_4_0_, account0_.checkin_at_work_module as checkin_5_4_0_, account0_.cj1_export as cj6_4_0_, account0_.company_id as company_7_4_0_, account0_.csv_import as csv_impo8_4_0_, account0_.default_date_pattern as default_9_4_0_, account0_.default_date_time_pattern as default10_4_0_, account0_.default_time_pattern as default11_4_0_, account0_.default_time_zone as default12_4_0_, account0_.default_view as default13_4_0_, account0_.deleted as deleted14_4_0_, account0_.display_as_decimal as display15_4_0_, account0_.instant_feedback as instant16_4_0_, account0_.language as languag17_4_0_, account0_.match_registration_hours as match_r18_4_0_, account0_.payroll_hours as payroll19_4_0_, account0_.project_tags as project20_4_0_, account0_.separate_date as separat21_4_0_, account0_.show_charts as show_ch22_4_0_, account0_.templa_link as templa_23_4_0_, account0_.vip_export as vip_exp24_4_0_ from account account0_ where account0_.id=?
Hibernate: select company0_.id as id1_14_0_, company0_.account_id as account_2_14_0_, company0_.address as address3_14_0_, company0_.city as city4_14_0_, company0_.cocnumber as cocnumbe5_14_0_, company0_.country as country6_14_0_, company0_.deleted as deleted7_14_0_, company0_.emailaddress as emailadd8_14_0_, company0_.logo_url as logo_url9_14_0_, company0_.name as name10_14_0_, company0_.phonenumber as phonenu11_14_0_, company0_.province as provinc12_14_0_, company0_.vatnumber as vatnumb13_14_0_, company0_.website as website14_14_0_, company0_.zipcode as zipcode15_14_0_ from company company0_ where company0_.id=?
INFO 2017-12-27 10:12:59,045 grails.app.jobs.com.x.NewLicenseJob - initial licenseperaccount null
INFO 2017-12-27 10:12:59,045 grails.app.jobs.com.x.NewLicenseJob - initial licenseperaccount [com.x.License : 9]
INFO 2017-12-27 10:12:59,045 grails.app.jobs.com.x.NewLicenseJob - licenseperaccount in else is [com.x.License : 9]
I fixed it by creating the list as follows:
List<License> licenseList = []
licenseList << license
accountLicenseMap.put(license.account, licenseList)
Instead of doing accountLicenseMap.put(license.account, license as List<License>)

Why image from image path is not displayed in UIImageView?

I am using AFNetworking 3.0.
i want to display image in UIImageView.
for that,
1. I sent parameter to server like following way:
.
.
.
[manager POST:Loginurl parameters:params progress:nil success:^(NSURLSessionTask *task, id responseObject) {
2. I got response from server like:
NSLog(#"Response from image server : %#", [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]);
When i print log:
Response from image server : http://Here_is_server_URL.jsp?uN=Rohit&wI=290119935030&pP=null&print=no7
3. I am going to display that image like following way:
_imgstr= [NSString stringWithFormat:#"%#",[[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]];
NSLog(#"%#",_imgstr);
NSString *imgURL = [NSString stringWithFormat:#"%#",_imgstr];
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:imgURL]];
[_image setImage:[UIImage imageWithData:data]];
4. When i displayed NSLog(#"imagedata:%#",data); i got following output
imagedata:<0d0a0d0a 0d0a0d0a 3c21444f 43545950 45206874 6d6c2050 55424c49 4320222d 2f2f5733 432f2f44 54442048 544d4c20 342e3031 20547261 6e736974 696f6e61 6c2f2f45 4e222022 68747470 3a2f2f77 77772e77 332e6f72 672f5452 2f68746d 6c342f6c 6f6f7365 2e647464 223e0d0a 3c68746d 6c3e0d0a 3c686561 643e0d0a 0d0a3c74 69746c65 3e323478 3757656c 6c6e6573 73202d20 57656c6c 6e657373 20436172 643c2f74 69746c65 3e0d0a3c 73637269 70743e0d 0a096675 6e637469 6f6e2070 72696e74 416e644f 75742829 207b0d0a 0909646f 63756d65 6e742e67 6574456c 656d656e 74427949 6428226d 79446976 22292e73 74796c65 2e626f72 64657220 3d202273 6f6c6964 20626c61 636b223b 0d0a2f2f 20090964 6f63756d 656e742e 67657445 6c656d65 6e744279 49642822 6d794469 7622292e 7374796c 652e7769 64746820 3d202235 32307078 223b0d0a 2f2f2009 09646f63 756d656e 742e6765 74456c65 6d656e74 42794964 28226d79 44697622 292e7374 796c652e 68656967 6874203d 20223330 30707822 3b0d0a09 09646f63 756d656e 742e6765 74456c65 6d656e74 42794964 28226d79 44697622 292e7374 796c652e 6267636f 6c6f7220 3d202223 30304646 3030223b 0d0a0909 77696e64 6f772e70 72696e74 28293b0d 0a09092f 2f77696e 646f772e 6c6f6361 74696f6e 2e687265 66203d20 22566965 7750726f 66696c65 73223b0d 0a097d0d 0a3c2f73 63726970 743e0d0a 3c737479 6c653e0d 0a2e6267 696d6720 7b0d0a09 6261636b 67726f75 6e642d69 6d616765 3a207572 6c282769 6d672f77 656c6c6e 65736361 72646267 696d6167 65322e6a 70672720 293b0d0a 09626163 6b67726f 756e642d 636f6c6f 723a2072 67626128 3235352c 20323535 2c203235 352c2030 2e353729 3b0d0a09 6261636b 67726f75 6e642d62 6c656e64 2d6d6f64 653a206c 69676874 656e3b0d 0a7d0d0a 3c2f7374 796c653e 0d0a0d0a 3c2f6865 61643e0d 0a0d0a3c 626f6479 3e0d0a0d 0a0d0a09 0d0a093c 62723e0d 0a093c62 723e0d0a 093c6365 6e746572 3e0d0a09 093c6272 3e203c62 723e0d0a 09093c64 69762069 643d226d 79446976 2220636c 6173733d 22626769 6d672220 7374796c 65203d20 22776964 74683a35 32307078 3b206865 69676874 3a333030 70783b62 6f726465 723a2073 6f6c6964 20626c61 636b223e 0d0a0d0a 0909093c 68313e32 34783757 656c6c6e 6573733c 2f68313e 0d0a0d0a 0909093c 7461626c 653e0d0a 09090909 3c74723e 0d0a0909 0909093c 74643e3c 696d6167 6520626f 72646572 3d223170 78222073 72633d22 696d672f 77656c6c 6e657373 5f6c6f67 6f2e6a70 67222068 65696768 743d2231 32307078 22207769 6474683d 22313130 7078223e 3c2f696d 6167653e 266e6273 703b266e 6273703b 266e6273 703b266e 6273703b 266e6273 703b266e 6273703b 266e6273 703b3c2f 74643e0d 0a090909 09093c74 643e0d0a 09090909 09093c63 656e7465 723e3c66 6f6e7420 73697a65 3d223670 78223e3c 623e7573 6b3c2f62 3e3c2f66 6f6e743e 3c2f6272 3e3c666f 6e742073 697a653d 22327078 223e3c62 3e205745 4c4c4e45 53532049 44203c2f 666f6e74 3e3c6272 3e203c66 6f6e740d 0a090909 09090973 697a653d 22367078 223e3236 30333139 37383332 37323c62 723e3c2f 666f6e74 3e3c2f63 656e7465 723e3c2f 74643e0d 0a090909 09093c74 643e266e 6273703b 266e6273 703b266e 6273703b 266e6273 703b266e 6273703b 266e6273 703b266e 6273703b 266e6273 703b266e 6273703b 266e6273 703b266e 6273703b 266e6273 703b266e 6273703b 0d0a0d0a 09090909 09093c69 6d616765 20626f72 6465723d 22317078 22207372 633d2269 6d672f67 6f62732e 6a706722 20686569 6768743d 22313230 70782220 77696474 683d2231 31307078 223e3c2f 696d6167 653e0d0a 09090909 093c2f74 643e0d0a 09090909 3c2f7472 3e0d0a09 09093c2f 7461626c 653e0d0a 0909093c 62723e0d 0a090909 3c62723e 0d0a0909 09566973 69742075 73204020 7777772e 32347837 77656c6c 6e657373 2e636f6d 20266e62 73703b26 6e627370 3b6f7226 6e627370 3b266e62 73703b20 63616c6c 20757320 40202b39 31203739 37323839 32363039 200d0a09 093c2f64 69763e0d 0a093c2f 63656e74 65723e3c 62723e3c 62723e0d 0a093c63 656e7465 723e0d0a 090d0a09 093c6120 68726566 203d2022 77656c6c 6e657373 63617264 2e6a7370 3f707269 6e743d79 65732677 493d3236 30333139 37383332 37322675 4e3d7573 6b222073 74796c65 203d2022 74657874 2d646563 6f726174 696f6e3a 6e6f6e65 3b223e0d 0a09093c 62757474 6f6e2074 79706520 3d202262 7574746f 6e223e50 72696e74 3c2f6275 74746f6e 3e0d0a09 093c2f61 3e0d0a09 09266e62 73703b26 6e627370 3b266e62 73703b26 6e627370 3b266e62 73703b0d 0a09093c 62757474 6f6e206f 6e636c69 636b203d 20227769 6e646f77 2e636c6f 73652829 3b223e43 6c6f7365 3c2f6275 74746f6e 3e0d0a09 0d0a093c 2f63656e 7465723e 0d0a3c2f 626f6479 3e0d0a3c 2f68746d 6c3e>
My problem is:
when i run the code there is no error, but the image is not displaying in UIImageView.
I don't want to use third party solution like SDWebImage.
what can i do for this issue?
Help will be appreciable.
Try to set the image on main thread like this:
dispatch_async(dispatch_get_global_queue(0,0), ^{
NSData * data = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: _imgstr]];
if ( data == nil )
return;
dispatch_async(dispatch_get_main_queue(), ^{
_image = [UIImage imageWithData: data];
});
});
What -Nirav D telling is correct ...
So here I explained that answer in detail for your clarification and believe that u resolve it
dispatch_async(dispatch_get_main_queue(), ^{
[_image setImage:[UIImage imageWithData:data]];
};
UI related task must perform on main thread only. so u can set image view image by using main thread.
Hope u resolve it quickly.

Apache Jena - not getting the desired result

I'm adding few resources and properties in a Model like this:
String xyz = "http://www.example.com/xyz";
String creator = "http://www.example.com/Harry";
String email = "http://www.example.com/harry#xyz.com";
Resource creat = m.createResource(creator);
Resource eId = m.createResource(email);
Resource res = m.createResource(xyz).addProperty(DC.creator,creat.addProperty(VCARD.EMAIL, eId));
m.write(System.out);
I'm getting this as a result:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"
xmlns:dc="http://purl.org/dc/elements/1.1/" >
<rdf:Description rdf:about="http://www.example.com/xyz">
<dc:creator rdf:resource="http://www.example.com/Harry"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.example.com/Harry">
<vcard:EMAIL rdf:resource="http://www.example.com/harry#xyz.com"/>
</rdf:Description>
</rdf:RDF>
Is there any other way by which I can get the result Like:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"
xmlns:dc="http://purl.org/dc/elements/1.1/" >
<rdf:Description rdf:about="http://www.example.com/xyz">
<dc:creator rdf:resource="http://www.example.com/Harry"/>
<vcard:EMAIL rdf:resource="http://www.example.com/harry#xyz.com"/>
</rdf:Description>
</rdf:RDF>
Try the RDF/XML pretty writer: Use
model.write( .... , "RDF/XML_ABBREV")
or use Turtle.

Resources