Custom Queries - 23.1

Spectrum Dataflow Designer Guide

Version
23.1
Language
English
Product name
Spectrum Technology Platform
Title
Spectrum Dataflow Designer Guide
First publish date
2007
Last updated
2024-05-09
Published on
2024-05-09T23:01:03.226155

This release provides a technical preview of custom queries in Neo4j Cypher query language.

To run custom queries, a user role must have Execute permission set for Context Graph Query Custom Script.

Custom Scripts for Context Graph in Spectrum Technology Platform 2023.1 use the Neo4j Cypher query language. To write scripts, you can refer to the Neo4j Cypher query language documentation.

  • Neo4j Cypher Manual Documents the Neo4j Cypher query language.
  • Neo4j Cypher Refcard A quick reference card of Neo4j Cypher query language commands and structures.
  • APOC User Guide Documents the APOC library of procedures and functions that solve many different tasks in Cypher, such as data integration, graph algorithms, and data conversion.

Custom scripts previously written in Gremlin must be rewritten in Neo4j Cypher to work with Context Graph in Spectrum Technology Platform 2023.1.

Limitations

Custom queries in this technical preview have the following limitations:

  • Nodes and edges returned directly in the RETURN (and not collected in lists or maps) are returned as Dynamic Graph fields.
  • Security is reduced when not using Dynamic Graph fields. In other words, data returned using Dynamic Graph Fields are secured using Model Data Security while data returned in other ways is not.
  • Types are converted based on metadata only when using Dynamic Graph fields.
  • When not using Dynamic Graph fields:
    • Float is returned as Double.
    • Integer is returned as Long.
    • BigDecimal is returned as string.
  • Unpredictable or missing results are liable to occur when mixing Dynamic Graph fields with other data types.

Input data

Input data can be used using Cypher Query parameter syntax (to access the Name input field use $Name).

Examples

Fuzzy Matching using APOC and input parameter Name
MATCH(person1:Person)-[relationship]->(person2:Person)
WHERE person1.Name <> person2.Name 
   AND apoc.text.doubleMetaphone(person1.Name) = apoc.text.doubleMetaphone(person2.Name)
RETURN person1, relationship, person2
Shortest Path using input parameters and Custom output
MATCH
(name:Person {Name: $Name1 } ),
(name2:Person {Name: $Name2 }),
p = allShortestPaths((name)-[*..6]-(name2))
RETURN p as paths