Trying to create a knowledge graph Map using JS Api

458
1
07-03-2023 12:34 PM
Labels (1)
DonJon
by
New Contributor II

Hey, 

I'm not very knowledgeable (*he*he*he) in Arcgis / Esri JS API. Basically I'am learning ArcGis knowledge and I am trying to add my knowledge Graph to a Web APP using snowpack (API 4.27.6)

 => Inspired by this ( https://www.esri.com/arcgis-blog/products/arcgis-knowledge/analytics/use-a-web-app-to-visualize-a-fa...)

So far I managed to add my Entities to a Map using the Knowledge Layer / Sublayer and a Point renderer. I have now been trying to add the relationships as lines, but this turns out to be less straight forward than I was hoping... As far as I understand this: The relationships cannot be added using a line renderer through the method I used for the points... so... get the point realtionships and coordinates and render a line? 

=> Using "MATCH q = (a)-->()-->(c) RETURN q LIMIT 1"

with the REST Service directory gives the Information I need (Coordinates, origin Id, destination ID etc.).... using it here: 

const knowlegeGraph = await knowledgeGraphService.fetchKnowledgeGraph(url)
const results = await knowledgeGraphService.executeQuery(
    knowlegeGraph,
    {
      openCypherQuery: "MATCH q = (a)-->()-->(b) RETURN q LIMIT 1",      
     }
     )
does not ??
The path result contains a mostly empty properties array and no spatial references... do I have to add them to my entity types manually ??
The coordinates have to exist somewhere, I mean the points are rendered correctly, though I could not find them inside a console.log() of the sublayers either 😞 
 
The data is very simple: one entity type with entities (I have generated them by placing each one on a Map in Pro), related through one type of relationship
 
Is there a better way to do this? Sorry for the amateur question, would be thankfull for some clues tho!
0 Kudos
1 Reply
MeganBanaski1
Esri Contributor

Hello, thank you for your question! Which version of ArcGIS Enterprise are you using? There were breaking changes in 11.1, so JS SDK 4.27 will only work with ArcGIS Enterprise 11.1+. This could be causing the problem you are seeing.

 

Making an edit to this, originally I did not see that you had the layers working fine and only the query is not working.

You could try taking out all of the variables and direction, it may help you to just get the return you're looking for from this query: "MATCH q = ()--()--() RETURN q LIMIT 1"

0 Kudos