Table of Contents | ||
---|---|---|
|
...
Here’s an example of simple Cypher Query:
Code Block |
---|
MATCH (n) RETURN n |
Example of Neo4j data
Neo4j database contains information about Persons and Movies and relation between them.
For getting information what movies related with person 'Meg Ryan' can be used nex CQL query:
Code Block |
---|
MATCH (person:Person {name: "Meg Ryan"})-[rel]-(movie) RETURN person, rel, movie |
Result of this query will be next:
Graf view | Text view | ||
---|---|---|---|
"person" | "rel" | "movie" | |
{"name":"Meg Ryan","born":1961} | {"roles":["DeDe","Angelica Graynamore","Patricia Graynamore"]} | {"title":"Joe Versus the Volcano", | |
{"name":"Meg Ryan","born":1961} | {"roles":["Sally Albright"]} | {"title":"When Harry Met Sally", | |
{"name":"Meg Ryan","born":1961} | {"roles":["Kathleen Kelly"]} | {"title":"You've Got Mail", | |
{"name":"Meg Ryan","born":1961} | {"roles":["Carole"]} | {"title":"Top Gun", | |
{"name":"Meg Ryan","born":1961} | {"roles":["Annie Reed"]} | {"title":"Sleepless in Seattle", |
Source Splitter
The proposal is to add "Splits Number" Source configuration property, which allows specifying the desired number of splits to divide the query into when reading from Neo4j.
Fewer splits may be created if the query cannot be divided into the desired number of splits.
Also, we can use '0' as the default value for this configuration property and determine the number of splits according to the number of map tasks (controlled by the "mapreduce.job.maps" property):
Code Block |
---|
public List<InputSplit> getSplits(JobContext job) throws IOException {
...
int targetNumTasks = job.getConfiguration().getInt(MRJobConfig.NUM_MAPS, 1);
... |
'MATCH ... RETURN COUNT(*)' CQL query can be used in order to get a total number of documents, that will be divided between splits using 'SKIP' and 'LIMIT'
Source Properties
Section | User Facing Name | Widget Type | Description | Constraints |
---|---|---|---|---|
General | Label | textbox | Label for UI. | |
Reference Name | textbox | Uniquely identified name for lineage. | Required | |
Neo4j Host | textbox | Neo4j database host. | Required | |
Neo4j Port | number | Neo4j database port. | Required | |
Input Query | textbox | The query to use to import data from the Neo4j database. | Required | |
Credentials | Username | textbox | User identity for connecting to the Neo4j. | Required |
Password | password | Password to use to connect to the Neo4j. | Required | |
Advanced | Splits Number | number | The number of splits to generate. If set to one, the orderBy is not needed. | |
Order By | textbox | Field Name which will be used for ordering during splits generation. This is required unless numSplits is set to one. |
...
Neo4j Data Types | CDAP Schema Data Types | ||
---|---|---|---|
null | null | ||
List | array | ||
Map | record | ||
Boolean | boolean | ||
Integer | long | ||
Float | double | ||
String | string | ||
ByteArray | bytes | ||
Date | date | ||
Time | time-micros | ||
LocalTime | time-micros | ||
DateTime | timestamp-micros | ||
LocalDateTime | timestamp-micros | ||
Node | record Schema example:
| ||
Relationship | record Schema example:
| ||
Duration A Duration represents a temporal amount, capturing the difference in time between two instants, and can be negative. | record Schema example:
| ||
Point | record Schema example:
| ||
Path |
...
Section | User Facing Name | Widget Type | Description | Constraints |
---|---|---|---|---|
General | Label | textbox | Label for UI. | |
Reference Name | textbox | Uniquely identified name for lineage. | Required | |
Neo4j Host | textbox | Neo4j database host. | Required | |
Neo4j Port | number | Neo4j database port. | Required | |
Output Query | textbox | The query to use to export data to the Neo4j database. Query example: 'CREATE (n:<label_field>l {property_1, property_2})'. | Required | |
Credentials | Username | textbox | User identity for connecting to the Neo4j. | Required |
Password | password | Password to use to connect to the Neo4j. | Required |
...