使用Gremlin.Net 3.3.2我得到了与Neptune和Cosmos DB截然不同的结果.两个平台上的图表数据相同.Cosmos DB为我提供了我需要的一切(顶点id,标签和属性).
当使用Gremlin.Net对Neptune进行查询时,我只获得顶点Id和标签.这是Neptune和Gremlin.net的错误吗?海王星的错误?
如果在gremlin控制台中执行查询,Neptune会返回所有数据,因此问题似乎仅限于Gremlin.Net.
query = gV().has('name',within('wind'))
Amazon Neptune results
{
"Id": "14b15642-842f-888a-a28e-3ed117a07d5b",
"Label": "keyword"
}
Cosmos DB results
{
"id": "wind",
"label": "keyword",
"type": "vertex",
"properties": {
"popularity": [
{
"id": "8f9967f1-cead-41d6-a432-de025d9dc14b",
"value": "16"
}
],
"name": [
{
"id": "fb90af3f-828b-4cc0-b9f8-b571a30c6b14",
"value": "wind"
}
]
}
}
Run Code Online (Sandbox Code Playgroud) 有没有办法暂停海王星?我想继续尝试它,但我每月面临数百美元,而我的实例大多是空闲的.理想情况下,我希望能够在我不使用它时关闭群集,然后使用相同的端点和设置启动备份.
我想指定自己的顶点ID。根据文档,他们像这样被支持
g.addV().property(id, 'customid')
没有引号id
。这导致JS将其解析为变量,并且失败(未定义的变量)。我要从哪里进口id
?
gremlin是否提供了克隆顶点的功能,例如
v1->v2, v1->v3, v1->v4
,我如何简单高效地创建一个新的顶点v5
,该顶点的边缘也指向v2, v3, v4
该v1's
边缘(边缘指向的位置相同),而不必显式设置它们,而是说类似的东西g.createV(v1).clone(v2)
。
请注意,我使用的是gremlin的AWS Neptune版本,解决方案必须与此兼容。
我目前正在尝试访问 AWS Neptune 服务器,但在尝试连接时收到以下错误。
我正在从 AWS 学习本教程,但没有成功:https : //docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin.html
有没有人遇到过这个问题?
我认为这是因为入站/出站规则,但即使我允许所有流量,它也不起作用。
终点也是正确的。双重检查。
conf/neptune-remote.yml
hosts: [neptuneTest.cu7geofyk01wr.us-east-1.neptune.amazonaws.com]
port: 8182
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }}
Run Code Online (Sandbox Code Playgroud)
错误
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin> :remote connect tinkerpop.server conf/neptune-remote.yaml
ERROR org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler - Could not process the response
io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response getStatus: 500 Internal Server Error
at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13.verify(WebSocketClientHandshaker13.java:191)
at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker.finishHandshake(WebSocketClientHandshaker.java:216)
at org.apache.tinkerpop.gremlin.driver.handler.WebSocketClientHandler.channelRead0(WebSocketClientHandler.java:69)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at …
Run Code Online (Sandbox Code Playgroud) 我正在针对AWS neptune使用nodejs gremlin,要求是如果顶点存在则更新属性,否则创建一个新顶点,我在下面尝试过
g.V().has('event','id','1').
fold().
coalesce(unfold(),
addV('event').property('id','1'))
Run Code Online (Sandbox Code Playgroud)
但我收到“展开未定义”错误,如何解决此问题?
我正在尝试运行简单的 CLEAR 和 DELETE SPARQL 查询并继续返回:
Malformed query: Encountered \" \"clear\" \"CLEAR \"\" at line
1, column 1.\n Was expecting one of:\n \"base\" ...\n \"prefix\"
...\n \"select\" ...\n \"construct\" ...\n \ "describe\" ...\n \"ask\" ...\n
Run Code Online (Sandbox Code Playgroud)
是否不支持 CLEAR 和 DELETE 查询?或者海王星是否有另一种清除实例中的图形的方法。
谢谢
我目前正在使用 gremlin-python 来研究图表。我想获得具有两个以上出边的所有顶点。我正在使用匿名遍历根据边缘计数过滤掉用户,但下面是我得到的错误。
AttributeError: 'list' 对象没有属性 'out'
我对此很陌生,不确定我在这里做错了什么。这是可用的有限 gremlin-python 教程/文档中描述的方式。
我用来awscurl
将数据从 s3 批量加载到 neptune 中:
我做了以下事情:
\n我得到的错误是:
\n\n\n找不到 iam_role_arn 的 aws 凭证:arn:aws:iam::1111111:role/NeptuneAdmin
\n
确保我拥有此证书的最佳方法是什么?我正在从本地执行此操作。
\nawscurl -X POST \\ \xe2\x94\x80\xe2\x95\xaf\n -H 'Content-Type: application/json' \\\n https://endpoint.us-west-2.neptune.amazonaws.com:8182/loader -d '\n {\n "source" : "s3://tf-bulk-load-test/vertex.txt",\n "format" : "csv",\n "iamRoleArn" : "arn:aws:iam::1111111111:role/NeptuneAdmin",\n "region" : "us-west-2",\n "failOnError" : "FALSE",\n "parallelism" : "MEDIUM",\n "updateSingleCardinalityProperties" : "FALSE",\n "queueRequest" : "TRUE",\n "dependencies" : []\n }' \\\n --header …
Run Code Online (Sandbox Code Playgroud) 我的背景:
我的问题是:
1) 如果我拥有要删除的顶点和边的所有特定 id,我可以在一笔事务中递归地删除顶点和边吗?目的是编写 python 函数来评估每个边,并确定是否需要删除它,并链接一个 gremlin 查询来删除它。
例如:
要删除的顶点 ID:
'vertex1', 'vertex2', 'vertex3'
Run Code Online (Sandbox Code Playgroud)
要删除的边 id:
'edge1', 'edge2', 'edge3'
Run Code Online (Sandbox Code Playgroud)
链接到 g 的 python 函数的示例如下:
def chain_drop(g, vertex_id):
g = g.V(vertex_id).drop()
return g
Run Code Online (Sandbox Code Playgroud)
我希望作为一个事务执行的链式查询理想情况下如下所示:
g.E('edge1').drop()
.V('vertex1').drop()
.E('edge3').drop()
.V('vertex3').drop()
.iterate() # execute all these queries as one transaction
Run Code Online (Sandbox Code Playgroud)
上面的方法不起作用...而且似乎我不能在我的 gremlin 查询中使用 .E('someid') 。
有点偏离主题,但我最好的尝试(非递归)如下所示:
g.E('edge1', 'edge2', 'edge3').as_('edges')
.V('vertex1', 'vertex2', 'vertex3').as_('vertices')
.union(__.select('edges'),
__.select('vertices'))
.drop()
.iterate()
Run Code Online (Sandbox Code Playgroud)
非常感谢任何帮助!
我正在尝试从 Python 代码内部对 AWS Neptune 数据库运行 Gremlin 查询,并希望将返回的数据存储到 Python 列表中。这对于简单的 Gremlin 查询工作正常,但一些更复杂的查询似乎有问题。
下面是代码,第一个 Gremlin 查询工作正常,但第二个不行。该节点不存在,因此可以在不导入任何数据的情况下进行尝试。
from __future__ import print_function # Python 2/3 compatibility
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
graph = Graph()
remoteConn = DriverRemoteConnection('wss://sdm-neptune-db-instance-1.cduuicw2rgrv.us-east-1.neptune.amazonaws.com:8182/gremlin','g')
g = graph.traversal().withRemote(remoteConn)
cust_List=g.V('AZ50K115E39AX').hasLabel('tp21tpcust').count().toList()
for p in cust_List:
print('Data Fetched: ' + str(p))
cust_List=g.V('XXXXXXXX').hasLabel('tp21tpcust').local(__.repeat(__.out().simplePath()).until(__.not_(__.out())).path().by(id).limit(100)).local(__.unfold().union(__.limit(1),__.tail()).fold()).dedup().toList()
for p in cust_List:
print('Data Fetched' + p)
remoteConn.close()
Run Code Online (Sandbox Code Playgroud)
这是错误,任何指导将不胜感激
Data Fetched: 1
Traceback (most recent call …
Run Code Online (Sandbox Code Playgroud) 我正在尝试找到一种在我的 AWS Neptune 图形数据库中使用 SPARQL 实施 SHACL 验证的方法。有办法这样做吗?
我正在尝试学习一些关于图形语言和查询语言 Gremlin 的知识。这是来自文档:
Amazon Neptune 与 Apache TinkerPop3 和 Gremlin 3.4.1 兼容。这意味着您可以连接到 Neptune 数据库实例并使用 Gremlin 遍历语言来查询图形(请参阅 Apache TinkerPop3 文档中的图形)。
海王星和 tinkerpop 2 不是相互竞争的图形数据库吗?一个数据库与另一个数据库兼容意味着什么?
也很好奇……为什么 apache 会发布它的查询语言 Gremlin 以用于其他数据库?这背后的想法是什么?
哦,我明白了,tinkerpop 是某种与海王星兼容的图形框架......无论如何。