Memo
Memo
ATApache TinkerPop
Created by Memo on 10/16/2024 in #questions
Basic vertex querying does not work in Amazon Neptune but it works with local Gremlin Server
const fankode : any = await this.gremlinService.readClientSource
.V( profileId )
.hasLabel( 'FAN' )
.next();
const fankode : any = await this.gremlinService.readClientSource
.V( profileId )
.hasLabel( 'FAN' )
.next();
When I try to fetch vertex with properties like this , or with elementMap() and valueMap(true), It does not work, it just fetches empty object. I can only query properties of a vertex like this in Amazon neptune
this.gremlinService.readClientSource
.V( profileId )
.hasLabel( 'FAN' )
.properties()
.toList(),
this.gremlinService.readClientSource
.V( profileId )
.hasLabel( 'FAN' )
.properties()
.toList(),
but then I would need two queries for basic fetching which I don't want due to performance reasons. Can anyone give me hand here? Thanks
9 replies
ATApache TinkerPop
Created by Memo on 8/27/2024 in #questions
Query works when executed in console but not in javascript
const combinedQuery = gremlin.V(profileId)
.project('following', 'follows')
.by(
__.inE('FOLLOWS').outV().dedup().id().fold()
)
.by(
__.outE('FOLLOWS').inV().dedup().id().fold()
)




const followingResult = await combinedQuery.next();

const followsResult = await combinedQuery.next();

this.logger.debug( `Serving: ${profileId} result: ${JSON.stringify( followingResult )} ` );
64507 - DEBUG [FetchRelationshipsService] Serving: a28beebb-6724-4012-917f-f7b90730dad3 result: {"value":{},"done":false}
'
const combinedQuery = gremlin.V(profileId)
.project('following', 'follows')
.by(
__.inE('FOLLOWS').outV().dedup().id().fold()
)
.by(
__.outE('FOLLOWS').inV().dedup().id().fold()
)




const followingResult = await combinedQuery.next();

const followsResult = await combinedQuery.next();

this.logger.debug( `Serving: ${profileId} result: ${JSON.stringify( followingResult )} ` );
64507 - DEBUG [FetchRelationshipsService] Serving: a28beebb-6724-4012-917f-f7b90730dad3 result: {"value":{},"done":false}
'
I get the logged output but when i run through console It works correctly :
{
"following": [
"c64a82c1-bae0-4380-a979-fc68d6a3a646",
"5f8cf1e3-cb3b-46b9-b2c1-6836ac13b06d"
],
"follows": [
"299eaaa9-8d1e-440e-b6d7-f82dd93dc1d9",
"5f8cf1e3-cb3b-46b9-b2c1-6836ac13b06d",
"c64a82c1-bae0-4380-a979-fc68d6a3a646"
]
}
{
"following": [
"c64a82c1-bae0-4380-a979-fc68d6a3a646",
"5f8cf1e3-cb3b-46b9-b2c1-6836ac13b06d"
],
"follows": [
"299eaaa9-8d1e-440e-b6d7-f82dd93dc1d9",
"5f8cf1e3-cb3b-46b9-b2c1-6836ac13b06d",
"c64a82c1-bae0-4380-a979-fc68d6a3a646"
]
}
What is wrong, why i cant have the query result correctly in js? Thanks
3 replies