I'm trying to follow NLP Goes hand in hand with graphs. I'm hitting a problem when running apoc.periodic.iterate
with google's nlp api and wondered if somebody could shed some light on this?
In the article, we have loaded a dataset of 10,000 articles into Neo4j and we are trying to classify each article using Google NLP. apoc.nlp.gcp.classify.graph
e.g.
CALL apoc.periodic.iterate("
// get all articles
MATCH (node:Article) RETURN node
","
// classify each article
CALL apoc.nlp.gcp.classify.graph(node, {
// we retrieve gcp api key from static value storage
key: apoc.static.get('gcp.apiKey'),
// node property that contains the text
nodeProperty: 'content',
write:true
}) YIELD graph RETURN distinct 'done'",
{batchSize:10})
I receive an error from Neo4J
org.neo4j.graphdb.QueryExecutionException: Failed to invoke procedure `apoc.nlp.gcp.classify.graph`: Caused by: org.neo4j.graphdb.NotFoundException: Node[12510] is deleted and cannot be used to create a relationship
Interestingly, if I rerun the query, it is Node[12511]
that is deleted. Also, we receive the same error if the sub query is LIMIT
ed to 10 nodes.
When I run the query outside of apoc.periodic.iterate
(albeit on a reduced node count) it works fine. e.g.
MATCH (node:Article)
WITH collect(node)[..10] AS articles
CALL apoc.nlp.gcp.classify.graph(articles, {
// we retrieve gcp api key from static value storage
key: apoc.static.get('gcp.apiKey'),
// node property that contains the text
nodeProperty: 'content',
write:true
}) YIELD graph as g RETURN g
Profile:
Explain:
Neo4j desktop Version 1.3.3 (1.3.3.24)
DBMS: Version: 4.1.0
apoc-nlp-dependencies-4.0.0.17.jar