您好,我现在正在使用 aws NeptuneDB(Gremlin)、NodeJs 作为后端、Angular 作为前端构建一个网站。现在我面临一个问题,我想在我的网站上进行分页,因为如果没有分页,我可能会在一次查询中加载并显示 5000 个项目。我知道在 MySQL 中,我们可以使用类似
select * from mydb limit 0, 20;
Run Code Online (Sandbox Code Playgroud)
进行分页。
我可以在 NeptuneDB(或 GraphDB)中实现类似的功能吗?我调查了一段时间,发现了这个: How to Perform pagination in Gremlin
参考这个问题的答案,看来我们无法避免将所有查询结果加载到内存中。这是否意味着有或没有分页没有任何区别。
或者我可以实现 Node 和 Angular 之间的分页(我只是猜测)?
那么有什么提高性能的想法吗?
I want child components in angular to separate Material Table(child) from other elements(parent), but the weird thing is that it seems I cannot get data from the parent or I get initialized data from parents and cannot refresh. Here is the Code: firstly, the parent .ts file:
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent implements OnInit{
ticketList: Ticket[] = [];
originalTicketList: Ticket[] = [];
filterAllForm: FormGroup;
labelList: string[];
homeLabelList: string[];
currentTicketId: string;
searchBy: string = ''; …Run Code Online (Sandbox Code Playgroud) 我现在使用 Angular 和 Spring Boot 来构建网站项目。当我们部署时,我们将ng build --output-path=../spring-boot-project/src/main/resources/static",在 spring boot 中 Angular 并生成一个静态文件夹,例如/resource/static. 然后我们构建一个 .jar 文件并将其部署到我们的产品(或实验室)环境中。
因此,当我们运行 .jar 文件时,如何将一些环境变量传递给 Angular 部分(Spring Boot 项目中的静态文件)。
更具体地说,我想在 Spring Boot application.yml 中设置角度环境:
spring:
profiles:
active: dev
main:
banner-mode: "off"
---
spring:
profiles: dev
angular.v1: "something1_dev"
angular.v2: "something2_dev"
---
spring:
profiles: prod
angular.v1: "something1_prod"
angular.v2: "something2_prod"
Run Code Online (Sandbox Code Playgroud)
我怎样才能将这些值(由于不同的轮廓而有不同的值)传递到有角度的一侧?
我试图将标签和关系设置为密码查询中的变量,因为我不想一一列出所有标签并为所有标签创建密码查询。
这就是我所做的:
class Neo4jClient(object):
def __init__(self, uri, user, password):
self._driver = GraphDatabase.driver(uri, auth=basic_auth(user, password))
def close(self):
self._driver.close()
def merge_nodes_relationships(self, anchor_data):
event = anchor_data.event
anchor = anchor_data.anchor
for k, v in anchor.items():
relation = session.write_transaction(self.create_event_anchor_relation, event, k, v)
@staticmethod
def create_event_anchor_relation(tx, event, anchorkey, anchorvalue):
result = tx.run("MATCH(e: Event {id : $eventid}), (a: $Anchor {id:$anchorvalue)"
"MERGE(e)-[r:$RelationShip]-(a)"
"RETURN r", eventid=event['id'], Anchor=anchorkey, anchorvalue=anchorvalue, RelationShip='EVENT_' + anchorkey
)
return result.single()[0]
Run Code Online (Sandbox Code Playgroud)
但错误抛出说
输入“$”无效:预期的空格或标签名称(第 1 行,第 10 列(偏移量:9))\n\"MERGE (a:$Anchor {id : $id})\"\n
那么我应该如何解决这个问题呢?如果不支持参数化标签或关系,当出现许多具有相同属性但需要不同标签名称的标签时,处理这种情况的最佳实践是什么。
这可能很容易,但我真的很难解决这个问题。我使用 gremlin python lib 和 aws neptune db。我知道顶点id,我只想获取顶点属性之一的值(python中的字符串类型),并更新它。
我尝试这样做:
print(g.V(event['securityEventManagerId']).values('sourceData'))
print(g.V(event['securityEventManagerId']).property('sourceData'))
print(g.V(event['securityEventManagerId']).property('sourceData').valueMap())
.....
Run Code Online (Sandbox Code Playgroud)
但我只是打印一些 python gremlin 对象GraphTraversal,例如,无法检索该值string
谁能帮我吗?
嗨,我现在正在使用 gremlin -javascript 在 AWS neptune DB 中进行一些查询。我有一个类似的查询
[errRelatedTicket, relatedTicket] = await to(g.V().hasId(a).in_('r').valueMap(true).toList());
Run Code Online (Sandbox Code Playgroud)
然后我得到一个地图列表,如:
[
Map {
id: 1
},
Map {
id: 2
},
]
Run Code Online (Sandbox Code Playgroud)
但是我可以使用 gremlin 查询直接获取键/值对中的 id 和属性吗?我期望的是:
[
{ id: 1 },
{ id: 2 },
]
Run Code Online (Sandbox Code Playgroud) angular ×3
gremlin ×3
javascript ×3
python ×2
java ×1
neo4j ×1
node.js ×1
pagination ×1
spring ×1
spring-boot ×1