cancel
Showing results for 
Search instead for 
Did you mean: 

NLP Knowledge Graph Tutorial

aduron
Node

I'm going through the tutorial at Tutorial: Build a Knowledge Graph using NLP and Ontologies - Developer Guides

Once I get to slide 15 I'm getting a no changes, no records. Possibly something to do with HAS_ENTITY? Any help appreciated thanks:

MATCH (c:Category {name: "NoSQL database management system"})
CALL n10s.inference.nodesInCategory(c, {
inCatRel: "ABOUT",
subCatRel: "SUB_CAT_OF"
})
YIELD node
MATCH (node)<-[:HAS_ENTITY]-(article)
RETURN article.uri AS uri, article.title AS title, article.datetime AS date,
collect(n10s.rdf.getIRILocalName(node.uri)) as explicitTopics
ORDER BY date DESC
LIMIT 5;

  • neo4j desktop version 1.4.8
  • which plugins / extensions / procedures do you use: APOC, n10s
6 REPLIES 6

sameer_gijare14
Graph Buddy

Hello

Please install GDS plugin that is compatible with desktop version that you have installed.

Thanking you
Sameer Sudhir G

Also install neosemantics 10s plugin
and load RDF Taxonomy into Project DB engine. After that you can use sparkle Query to extract RDF triplets (documents from Marklogic). But may be you will need to apply transformation logic of your own embedded inside a plugin to achieve whatever your goal is.

Thanking you
Sameer Sudhir G

DMF194
Node Clone

Hi there,

I have also started following at Tutorial: Build a Knowledge Graph using NLP and Ontologies - Developer Guides.

Able to following along with no issues until the part where I need to import RDF from WikiData

WITH "https://query.wikidata.org/sparql?query=prefix%20neo%3A%20%3Cneo4j%3A%2F%2Fvoc%23%3E%20%0A%23Cats%0A%23SELECT%20%3Fitem%20%3Flabel%20%0ACONSTRUCT%20%7B%0A%3Fitem%20a%20neo%3ACategory%20%3B%20neo%3AsubCatOf%20%3FparentItem%20.%20%20%0A%20%20%3Fitem%20neo%3Aname%20%3Flabel%20.%0A%20%20%3FparentItem%20a%20neo%3ACategory%3B%20neo%3Aname%20%3FparentLabel%20.%0A%20%20%3Farticle%20a%20neo%3AWikipediaPage%3B%20neo%3Aabout%20%3Fitem%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%0A%7D%0AWHERE%20%0A%7B%0A%20%20%3Fitem%20(wdt%3AP31%7Cwdt%3AP279)*%20wd%3AQ2429814%20.%0A%20%20%3Fitem%20wdt%3AP31%7Cwdt%3AP279%20%3FparentItem%20.%0A%20%20%3Fitem%20rdfs%3Alabel%20%3Flabel%20.%0A%20%20filter(lang(%3Flabel)%20%3D%20%22en%22)%0A%20%20%3FparentItem%20rdfs%3Alabel%20%3FparentLabel%20.%0A%20%20filter(lang(%3FparentLabel)%20%3D%20%22en%22)%0A%20%20%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%20%20%3Farticle%20schema%3Aabout%20%3Fitem%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20schema%3AinLanguage%20%22en%22%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20schema%3AisPartOf%20%3Chttps%3A%2F%2Fen.wikipedia.org%2F%3E%20.%0A%20%20%20%20%7D%0A%20%20%0A%7D" AS softwareSystemsUri
CALL n10s.rdf.import.fetch(softwareSystemsUri, 'Turtle' , { headerParams: { Accept: "application/x-turtle" } })
YIELD terminationStatus, triplesLoaded, triplesParsed, namespaces, callParams
RETURN terminationStatus, triplesLoaded, triplesParsed, namespaces, callParams;

For whatever reason, the result is KO

I have also added the line below in my neo4j.config file

dbms.unmanaged_extension_classes=n10s.endpoint=/rdf

OS: Windows10
Neo4j: 1.4.11
neosemantic: 4.4.0
apoc-nlp-dependencies-4.4.0.3jar

Any suggestions would be advised.

Hello

As a remote observer I noticed that you are using SparkQL.Have you imported necessary ontologies for that? I guess there is a separate ontology for with name like rdf triples.Its just a guess but anyways you are the best judge for your Neo4j desktop.

Many thanks
Mr Sameer Sudhir Gijare

HI @sameer.gijare14,

Yes I am using SparkQL from WikiData

Based on my current understanding, the code below is used to import taxonomies from Software Systems using the WikiData API

WITH "https://query.wikidata.org/sparql?query=prefix%20neo%3A%20%3Cneo4j%3A%2F%2Fvoc%23%3E%20%0A%23Cats%0A%23SELECT%20%3Fitem%20%3Flabel%20%0ACONSTRUCT%20%7B%0A%3Fitem%20a%20neo%3ACategory%20%3B%20neo%3AsubCatOf%20%3FparentItem%20.%20%20%0A%20%20%3Fitem%20neo%3Aname%20%3Flabel%20.%0A%20%20%3FparentItem%20a%20neo%3ACategory%3B%20neo%3Aname%20%3FparentLabel%20.%0A%20%20%3Farticle%20a%20neo%3AWikipediaPage%3B%20neo%3Aabout%20%3Fitem%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%0A%7D%0AWHERE%20%0A%7B%0A%20%20%3Fitem%20(wdt%3AP31%7Cwdt%3AP279)*%20wd%3AQ2429814%20.%0A%20%20%3Fitem%20wdt%3AP31%7Cwdt%3AP279%20%3FparentItem%20.%0A%20%20%3Fitem%20rdfs%3Alabel%20%3Flabel%20.%0A%20%20filter(lang(%3Flabel)%20%3D%20%22en%22)%0A%20%20%3FparentItem%20rdfs%3Alabel%20%3FparentLabel%20.%0A%20%20filter(lang(%3FparentLabel)%20%3D%20%22en%22)%0A%20%20%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%20%20%3Farticle%20schema%3Aabout%20%3Fitem%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20schema%3AinLanguage%20%22en%22%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20schema%3AisPartOf%20%3Chttps%3A%2F%2Fen.wikipedia.org%2F%3E%20.%0A%20%20%20%20%7D%0A%20%20%0A%7D" AS softwareSystemsUri
CALL n10s.rdf.import.fetch(softwareSystemsUri, 'Turtle' , { headerParams: { Accept: "application/x-turtle" } })
YIELD terminationStatus, triplesLoaded, triplesParsed, namespaces, callParams
RETURN terminationStatus, triplesLoaded, triplesParsed, namespaces, callParams;

As you said I am using the Neo4j Desktop and I am using the Neosemantics plugin in Neo4j Desktop to import the taxonomy

Is there an updated document on this as I feel it does not provide a complete picture?

asalalikhani
Node Link

Hi, 

I'm going through the tutorial at Tutorial: Build a Knowledge Graph using NLP and Ontologies - Developer Guides

once I try to execute this cypher code

CALL apoc.nlp.gcp.entities.stream(a, {
nodeProperty: 'body',
key: $key
})
YIELD node, value
SET node.processed = true
WITH node, value
UNWIND value.entities AS entity
RETURN entity
LIMIT 5;

I encounter with this error

Failed to invoke procedure `apoc.nlp.gcp.entities.stream`: Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://language.googleapis.com/v1/documents:analyzeEntities?key=<AIzaSyAz-UWmDmy27J7uhMM0j8jrsGGhXSWOFus>

Neo4j desktop 4.4.7
I couldn't install neosemantics plugin, is that why this error occurs?

Thanks