Comments (16)
For anyone would like to take, I'll create corresponding tasks in separate issue.
cc @CorvusYe
from ngbatis.
@shbone
Yes, you are right about that.
And one more thing is that these interfaces should preferably have a batched parameter. Because there is a limit to the length of a script that can be executed once.
from ngbatis.
What do you think ablout declaring a model, such as:
public class NgTriplet<I> {
private I srcId;
private I dstId;
private Object start;
private Object edge;
private Object end;
NgTriplet( Object start, Object edge, Object end ) {
// ...
}
}
triplets = new ArrayList() {{
add( new NgTriplet( person1, like, person2) );
}};
So that, we can use dao.insertEdgeBatch( triplets )
XML is roughly like this. But there may be some errors, you can debug it again
<insert id="insertEdgeBatch">
@for ( row in ng_args[0] ) {
@var kv = ng.kv( row.edge, '', null, null, false );
@var vId1 = ng.id( row.start );
@var rank = ng.id( row.edge, false );
@var vId2 = ng.id( row.end );
@var e = ng.tagName( row.edge );
INSERT EDGE `${ e }` (
${ ng.join( @kv.columns, ", ", "ng.schemaFmt" ) }
)
VALUES ${ vId1 }-> ${ vId2 } ${ isNotEmpty( rank ) ? ('@' + rank) : '' } :(
${ ng.join( @kv.values ) }
);
@}
</insert>
from ngbatis.
Hi @wey-gu, I would like to contribute for the above task, if you could just explain in a little detail what needs to be done exactly.
from ngbatis.
Hi @wey-gu, I would like to contribute for the above task, if you could just explain in a little detail what needs to be done exactly.
Wow, welcome to the NebulaGraph community!
@CorvusYe could you plz help explain some of the tasks that @amritagg could start from?
from ngbatis.
Hi @amritagg
I'm glad you're interested in these features.
We need to add methods to NebulaDaoBasic that allow developers to quickly access data without having to write ngql
Just like its other interfaces.https://github.com/nebula-contrib/ngbatis/blob/master/src/main/java/org/nebula/contrib/ngbatis/proxy/NebulaDaoBasic.java
The idea is to extract the more commonly used scripts, as the name of the task item means.
For example, show metas, developers can quickly get schema information by calling the interface, tag, edgeType, etc.
cc: @wey-gu
from ngbatis.
Created subtask for this in #237
from ngbatis.
@wey-gu @CorvusYe thanks for explaining the task to be me but I won't be able to complete this task as this is quite complicated for me.
from ngbatis.
The API is similar to this section, but without the process of parsing the results.
from ngbatis.
I want to have a try to achieve insertEdgeBatch
or insertTripletBatch
.
And I want to imitate this interface insertEdge
ngbatis/src/main/java/org/nebula/contrib/ngbatis/proxy/NebulaDaoBasic.java
Lines 319 to 334 in d6b73ea
@CorvusYe
If I need to add this to the demo first and test it ,then add it to the src
directory? Thank you
from ngbatis.
How to debug and print the nGQL script with Beetl Template? Thank you! @CorvusYe
print
or other method ? I have some problme with the use of nGQL.
from ngbatis.
@shbone
Do you mean to print nGQL on the console?
Add the following configuration to yml
logging:
level:
org.nebula.contrib: DEBUG
https://graph-cn.github.io/ngbatis-docs/step-forward-docs/advanced-configuration.html
from ngbatis.
And the only entry and exit for the generated nGQL is here
from ngbatis.
@shbone Do you mean to print nGQL on the console?
Add the following configuration to yml
logging: level: org.nebula.contrib: DEBUGhttps://graph-cn.github.io/ngbatis-docs/step-forward-docs/advanced-configuration.html
I have add the configuration and output is here.
But I don't know how to fix the nGQL error, and I want to debug the script with the use of print
2023-10-09 12:41:40.311 DEBUG 91379 --- [ main] o.n.contrib.ngbatis.proxy.MapperProxy :
- proxyMethod: sun.reflect.NativeMethodAccessorImpl#invoke
- session space: null
- auto switch to: test
- nGql:
- params: {p0=[{"person2":{"name":"P2_0"},"person1":{"name":"P1_0"},"like":{"likeness":0.202210171102}},{"person2":{"name":"P2_1"},"person1":{"name":"P1_1"},"like":{"likeness":0.202210171102}},{"person2":{"name":"P2_2"},"person1":{"name":"P1_2"},"like":{"likeness":0.202210171102}}]}
- result:ExecutionResponse (
error_code : E_STATEMENT_EMPTY (E_STATEMENT_EMPTY),
latency_in_us : 90,
space_name : 74 65 73 74,
error_msg : 53 74 61 74 65 6D 65 6E 74 45 6D 70 74 79 3A 20
)
org.nebula.contrib.ngbatis.exception.QueryException: 数据查询失败: 数据查询失败StatementEmpty:
at org.nebula.contrib.ngbatis.proxy.MapperProxy.executeWithParameter(MapperProxy.java:241)
at org.nebula.contrib.ngbatis.proxy.MapperProxy.invoke(MapperProxy.java:131)
at org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic.insertEdgeBatch(NebulaDaoBasic.java:338)
at ye.weicheng.ngbatis.demo.NebulaBasicDaoTests.insertEdgeBatchWithProps(NebulaBasicDaoTests.java:419)
The nGQL script is to insert the batch of edges , and I use the personLikePerson
class, But it have this error.
I want to know how to fix it.Thank you!
<insert id="insertEdgeBatch">
@for ( row in ng_args[0] ) {
@var kv = ng.kv( row, '', true, true );
print(kv)
@}
</insert>
from ngbatis.
You can refer to this http://bbs.ibeetl.com/beetlonline/
But you need to change @for
to <% for
from ngbatis.
Thank you your template! I will have a try
What do you think ablout declaring a model, such as:
public class NgTriplet<I> { private I srcId; private I dstId; private Object start; private Object edge; private Object end; NgTriplet( Object start, Object edge, Object end ) { // ... } }triplets = new ArrayList() {{ add( new NgTriplet( person1, like, person2) ); }};So that, we can use
dao.insertEdgeBatch( triplets )
XML is roughly like this. But there may be some errors, you can debug it again
<insert id="insertEdgeBatch"> @for ( row in ng_args[0] ) { @var kv = ng.kv( row.edge, '', null, null, false ); @var vId1 = ng.id( row.start ); @var rank = ng.id( row.edge, false ); @var vId2 = ng.id( row.end ); @var e = ng.tagName( row.edge ); INSERT EDGE `${ e }` ( ${ ng.join( @kv.columns, ", ", "ng.schemaFmt" ) } ) VALUES ${ vId1 }-> ${ vId2 } ${ isNotEmpty( rank ) ? ('@' + rank) : '' } :( ${ ng.join( @kv.values ) } ); @} </insert>
from ngbatis.
Related Issues (20)
- bulk insert for edges HOT 2
- go from语句 HOT 16
- error on dependency version HOT 9
- docs: searching in en docs is broken HOT 2
- No extra connection: All servers are broken. HOT 2
- 批量插入数据报错 HOT 1
- NebulaDaoBasic是否可以实现一个listEndNodes方法 HOT 3
- 支持 springboot 3.x 有时间计划嘛? HOT 8
- The problem and solution of the first query taking a long time. 第一次查询的性能问题及解决方法
- 两个脚本都基于 USE SPACE 动态切换图空间,第一个生效,第二个不生效。
- 微信丨NgBatis交流群 · NGC22 0611-29
- StackOverflowError HOT 5
- java.net.SocketException: Socket closed HOT 1
- ResultSet error: SyntaxError: syntax error near ` go ' HOT 7
- 返回值映射问题 HOT 1
- Create Session failed HOT 2
- 龙行龘龘,灯火万家
- 同mybatis-plus共用提示:java.lang.NullPointerException at org.nebula.contrib.ngbatis.proxy.MapperProxy.invoke(MapperProxy.java:74) HOT 2
- When using `@Transient` for entity classes, please do not use v1.2.2 for now
- nebula.ngbatis.password encryption with druid
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngbatis.