提交 fd0c41f0 编写于 作者: M Mark Needham

apoc.meta

上级 05aadccd
......@@ -6,3 +6,4 @@
¦apoc.util.sha256(values :: LIST? OF ANY?) :: (STRING?)
¦apoc.util.sha384(values :: LIST? OF ANY?) :: (STRING?)
¦apoc.util.sha512(values :: LIST? OF ANY?) :: (STRING?)
¦apoc.util.validatePredicate(predicate :: BOOLEAN?, message :: STRING?, params :: LIST? OF ANY?) :: (BOOLEAN?)
......@@ -6,3 +6,4 @@
¦function¦apoc.util.sha256¦apoc.util.sha256(values :: LIST? OF ANY?) :: (STRING?)¦apoc.util.sha256([values]) | computes the sha256 of the concatenation of all string values of the list
¦function¦apoc.util.sha384¦apoc.util.sha384(values :: LIST? OF ANY?) :: (STRING?)¦apoc.util.sha384([values]) | computes the sha384 of the concatenation of all string values of the list
¦function¦apoc.util.sha512¦apoc.util.sha512(values :: LIST? OF ANY?) :: (STRING?)¦apoc.util.sha512([values]) | computes the sha512 of the concatenation of all string values of the list
¦function¦apoc.util.validatePredicate¦apoc.util.validatePredicate(predicate :: BOOLEAN?, message :: STRING?, params :: LIST? OF ANY?) :: (BOOLEAN?)¦apoc.util.validatePredicate(predicate, message, params) | if the predicate yields to true raise an exception else returns true, for use inside WHERE subclauses
......@@ -526,5 +526,6 @@ for the provided `label` and `uuidProperty`, in case the UUID handler is already
¦function¦apoc.util.sha256¦apoc.util.sha256(values :: LIST? OF ANY?) :: (STRING?)¦apoc.util.sha256([values]) | computes the sha256 of the concatenation of all string values of the list¦true¦
¦function¦apoc.util.sha384¦apoc.util.sha384(values :: LIST? OF ANY?) :: (STRING?)¦apoc.util.sha384([values]) | computes the sha384 of the concatenation of all string values of the list¦true¦
¦function¦apoc.util.sha512¦apoc.util.sha512(values :: LIST? OF ANY?) :: (STRING?)¦apoc.util.sha512([values]) | computes the sha512 of the concatenation of all string values of the list¦true¦
¦function¦apoc.util.validatePredicate¦apoc.util.validatePredicate(predicate :: BOOLEAN?, message :: STRING?, params :: LIST? OF ANY?) :: (BOOLEAN?)¦apoc.util.validatePredicate(predicate, message, params) | if the predicate yields to true raise an exception else returns true, for use inside WHERE subclauses¦true¦
¦function¦apoc.version¦apoc.version() :: (STRING?)¦RETURN apoc.version() | return the current APOC installed version¦true¦
¦function¦apoc.xml.parse¦apoc.xml.parse(data :: STRING?, path = / :: STRING?, config = {} :: MAP?, simple = false :: BOOLEAN?) :: (MAP?)¦RETURN apoc.xml.parse(<xml string>, <xPath string>, config, false) AS value¦true¦xref::import/xml.adoc
......@@ -8,22 +8,22 @@ image::apoc.meta.graph.jpg[scaledwidth="100%"]
.Procedures
[cols="5m,5"]
|===
| CALL apoc.meta.graphSample() | examines the database statistics to build the meta graph, very fast, might report extra relationships
| CALL apoc.meta.graph | examines the database statistics to create the meta-graph, post filters extra relationships by sampling
| CALL apoc.meta.subGraph({labels:[labels],rels:[rel-types],excludes:[label,rel-type,...]}) | examines a sample sub graph to create the meta-graph
| CALL apoc.meta.data | examines a subset of the graph to provide a tabular meta information
| CALL apoc.meta.schema | examines a subset of the graph to provide a map-like meta information
| CALL apoc.meta.stats yield labelCount, relTypeCount, propertyKeyCount, nodeCount, relCount, labels, relTypes, stats | returns the information stored in the transactional database statistics
| CALL apoc.meta.nodeTypeProperties({includeLabels:[label,...],includeRels:[rel-type,...],excludeLabels:[label,,...],excludeRels:[rel-type,...]}) | replaces built-in function for node property schema to provide a sample-based result for high performance - used by the Neo4J BI Connector
| CALL apoc.meta.relTypeProperties({includeLabels:[label,...],includeRels:[rel-type,...],excludeLabels:[label,...],excludeRels:[rel-type,...]}) | replaces built-in function for relationship property schema to provide a sample-based result for high performance - used by the Neo4J BI Connector
| xref::overview/apoc.meta/apoc.meta.graphSample.adoc[CALL apoc.meta.graphSample()] | examines the database statistics to build the meta graph, very fast, might report extra relationships
| xref::overview/apoc.meta/apoc.meta.graph.adoc[CALL apoc.meta.graph] | examines the database statistics to create the meta-graph, post filters extra relationships by sampling
| xref::overview/apoc.meta/apoc.meta.subGraph.adoc[+++CALL apoc.meta.subGraph({labels:[labels],rels:[rel-types],excludes:[label,rel-type,...]})+++] | examines a sample sub graph to create the meta-graph
| xref::overview/apoc.meta/apoc.meta.data.adoc[CALL apoc.meta.data] | examines a subset of the graph to provide a tabular meta information
| xref::overview/apoc.meta/apoc.meta.schema.adoc[CALL apoc.meta.schema] | examines a subset of the graph to provide a map-like meta information
| xref::overview/apoc.meta/apoc.meta.stats.adoc[CALL apoc.meta.stats yield labelCount, relTypeCount, propertyKeyCount, nodeCount, relCount, labels, relTypes, stats] | returns the information stored in the transactional database statistics
| xref::overview/apoc.meta/apoc.meta.nodeTypeProperties.adoc[+++CALL apoc.meta.nodeTypeProperties({includeLabels:[label,...],includeRels:[rel-type,...],excludeLabels:[label,,...],excludeRels:[rel-type,...]})+++] | replaces built-in function for node property schema to provide a sample-based result for high performance - used by the Neo4J BI Connector
| xref::overview/apoc.meta/apoc.meta.relTypeProperties.adoc[+++CALL apoc.meta.relTypeProperties({includeLabels:[label,...],includeRels:[rel-type,...],excludeLabels:[label,...],excludeRels:[rel-type,...]})+++] | replaces built-in function for relationship property schema to provide a sample-based result for high performance - used by the Neo4J BI Connector
|===
.Functions
[cols="5m,5"]
|===
| apoc.meta.cypher.type(value) | type name of a value (`INTEGER,FLOAT,STRING,BOOLEAN,RELATIONSHIP,NODE,PATH,NULL,MAP,LIST OF <TYPE>,POINT,DATE,DATE_TIME,LOCAL_TIME,LOCAL_DATE_TIME,TIME,DURATION`)
| apoc.meta.cypher.isType(value,type) | returns a row if type name matches none if not
| apoc.meta.cypher.types(node or relationship or map) | returns a a map of property-keys to their names
| xref::overview/apoc.meta/apoc.meta.cypher.type.adoc[apoc.meta.cypher.type(value)] | type name of a value (`INTEGER,FLOAT,STRING,BOOLEAN,RELATIONSHIP,NODE,PATH,NULL,MAP,LIST OF <TYPE>,POINT,DATE,DATE_TIME,LOCAL_TIME,LOCAL_DATE_TIME,TIME,DURATION`)
| xref::overview/apoc.meta/apoc.meta.cypher.isType.adoc[apoc.meta.cypher.isType(value,type)] | returns a row if type name matches none if not
| xref::overview/apoc.meta/apoc.meta.cypher.types.adoc[apoc.meta.cypher.types(node or relationship or map)] | returns a a map of property-keys to their names
|===
In the case of `LIST` you may have many results, depending on the content. In the event that all contents are of the same type, will you have the `LIST OF <TYPE>`, otherwise if the type is different, will you get `LIST OF ANY`
......
......@@ -99,7 +99,7 @@ include::partial$createExportGraph.adoc[]
The Neo4j Browser visualization below shows the imported graph:
image::play-movies.png[title="Movies Graph Visualization"]
:play-movies.png[title="Movies Graph Visualization"]image:
[[export-cypher-cypher-shell]]
=== Export to Cypher Shell format
......
......@@ -25,5 +25,9 @@ apoc.meta.cypher.isType(value :: ANY?, type :: STRING?) :: (BOOLEAN?)
|type|STRING?|null
|===
[[usage-apoc.meta.cypher.isType]]
== Usage Examples
include::partial$usage/apoc.meta.cypher.isType.adoc[]
xref::database-introspection/meta.adoc[More documentation of apoc.meta.cypher.isType,role=more information]
......@@ -24,5 +24,9 @@ apoc.meta.cypher.type(value :: ANY?) :: (STRING?)
|value|ANY?|null
|===
[[usage-apoc.meta.cypher.type]]
== Usage Examples
include::partial$usage/apoc.meta.cypher.type.adoc[]
xref::database-introspection/meta.adoc[More documentation of apoc.meta.cypher.type,role=more information]
......@@ -24,5 +24,9 @@ apoc.meta.cypher.types(properties :: ANY?) :: (MAP?)
|properties|ANY?|null
|===
[[usage-apoc.meta.cypher.types]]
== Usage Examples
include::partial$usage/apoc.meta.cypher.types.adoc[]
xref::database-introspection/meta.adoc[More documentation of apoc.meta.cypher.types,role=more information]
......@@ -24,6 +24,9 @@ apoc.meta.data(config = {} :: MAP?) :: (label :: STRING?, property :: STRING?, c
|config|MAP?|{}
|===
== Config parameters
include::partial$usage/config/apoc.meta.data.adoc[]
== Output parameters
[.procedures, opts=header]
|===
......@@ -46,5 +49,9 @@ apoc.meta.data(config = {} :: MAP?) :: (label :: STRING?, property :: STRING?, c
|elementType|STRING?
|===
[[usage-apoc.meta.data]]
== Usage Examples
include::partial$usage/apoc.meta.data.adoc[]
xref::database-introspection/meta.adoc[More documentation of apoc.meta.data,role=more information]
......@@ -32,5 +32,9 @@ apoc.meta.graph(config = {} :: MAP?) :: (nodes :: LIST? OF NODE?, relationships
|relationships|LIST? OF RELATIONSHIP?
|===
[[usage-apoc.meta.graph]]
== Usage Examples
include::partial$usage/apoc.meta.graph.adoc[]
xref::database-introspection/meta.adoc[More documentation of apoc.meta.graph,role=more information]
......@@ -32,5 +32,9 @@ apoc.meta.graphSample(config = {} :: MAP?) :: (nodes :: LIST? OF NODE?, relation
|relationships|LIST? OF RELATIONSHIP?
|===
[[usage-apoc.meta.graphSample]]
== Usage Examples
include::partial$usage/apoc.meta.graphSample.adoc[]
xref::database-introspection/meta.adoc[More documentation of apoc.meta.graphSample,role=more information]
......@@ -31,5 +31,9 @@ apoc.meta.schema(config = {} :: MAP?) :: (value :: MAP?)
|value|MAP?
|===
[[usage-apoc.meta.schema]]
== Usage Examples
include::partial$usage/apoc.meta.schema.adoc[]
xref::database-introspection/meta.adoc[More documentation of apoc.meta.schema,role=more information]
......@@ -32,5 +32,9 @@ apoc.meta.stats() :: (labelCount :: INTEGER?, relTypeCount :: INTEGER?, property
|stats|MAP?
|===
[[usage-apoc.meta.stats]]
== Usage Examples
include::partial$usage/apoc.meta.stats.adoc[]
xref::database-introspection/meta.adoc[More documentation of apoc.meta.stats,role=more information]
......@@ -32,5 +32,9 @@ apoc.meta.subGraph(config :: MAP?) :: (nodes :: LIST? OF NODE?, relationships ::
|relationships|LIST? OF RELATIONSHIP?
|===
[[usage-apoc.meta.subGraph]]
== Usage Examples
include::partial$usage/apoc.meta.subGraph.adoc[]
xref::database-introspection/meta.adoc[More documentation of apoc.meta.subGraph,role=more information]
......@@ -14,7 +14,7 @@ apoc.util.validatePredicate(predicate, message, params) | if the predicate yield
[source]
----
apoc.util.validatePredicate(predicate :: BOOLEAN?, message :: STRING?, params :: LIST? OF ANY?) :: BOOLEAN
apoc.util.validatePredicate(predicate :: BOOLEAN?, message :: STRING?, params :: LIST? OF ANY?) :: (BOOLEAN?)
----
== Input parameters
......
......@@ -43,5 +43,10 @@ apoc.util.sha384([values]) \| computes the sha384 of the concatenation of all st
apoc.util.sha512([values]) \| computes the sha512 of the concatenation of all string values of the list
|label:function[]
|label:apoc-core[]
|xref::overview/apoc.util/apoc.util.validatePredicate.adoc[apoc.util.validatePredicate icon:book[]]
apoc.util.validatePredicate(predicate, message, params) \| if the predicate yields to true raise an exception else returns true, for use inside WHERE subclauses
|label:function[]
|label:apoc-core[]
|===
......@@ -3052,6 +3052,11 @@ apoc.util.sha384([values]) \| computes the sha384 of the concatenation of all st
apoc.util.sha512([values]) \| computes the sha512 of the concatenation of all string values of the list
|label:function[]
|label:apoc-core[]
|xref::overview/apoc.util/apoc.util.validatePredicate.adoc[apoc.util.validatePredicate icon:book[]]
apoc.util.validatePredicate(predicate, message, params) \| if the predicate yields to true raise an exception else returns true, for use inside WHERE subclauses
|label:function[]
|label:apoc-core[]
|===
== xref::overview/apoc.uuid/index.adoc[]
......
......@@ -586,6 +586,7 @@ This file is generated by DocsTest, so don't change it!
*** xref::overview/apoc.util/apoc.util.sha256.adoc[]
*** xref::overview/apoc.util/apoc.util.sha384.adoc[]
*** xref::overview/apoc.util/apoc.util.sha512.adoc[]
*** xref::overview/apoc.util/apoc.util.validatePredicate.adoc[]
** xref::overview/apoc.uuid/index.adoc[]
*** xref::overview/apoc.uuid/apoc.uuid.install.adoc[]
*** xref::overview/apoc.uuid/apoc.uuid.list.adoc[]
......
[source,cypher]
----
RETURN apoc.meta.cypher.isType(1, "NODE") AS output;
----
.Results
[opts="header"]
|===
| output
| FALSE
|===
[source,cypher]
----
RETURN apoc.meta.cypher.isType(datetime(), "DATE_TIME") AS output;
----
.Results
[opts="header"]
|===
| output
| TRUE
|===
[source,cypher]
----
RETURN apoc.meta.cypher.type(1) AS output;
----
.Results
[opts="header"]
|===
| output
| "INTEGER"
|===
[source,cypher]
----
RETURN apoc.meta.cypher.type("Michael") AS output;
----
.Results
[opts="header"]
|===
| output
| "STRING"
|===
[source,cypher]
----
RETURN apoc.meta.cypher.type(true) AS output;
----
.Results
[opts="header"]
|===
| output
| "BOOLEAN"
|===
[source,cypher]
----
RETURN apoc.meta.cypher.type(datetime()) AS output;
----
.Results
[opts="header"]
|===
| output
| "DATE_TIME"
|===
[source,cypher]
----
RETURN apoc.meta.cypher.type(["Neo4j", 2020]) AS output;
----
.Results
[opts="header"]
|===
| output
| "LIST OF ANY"
|===
[source,cypher]
----
RETURN apoc.meta.cypher.type(["Neo4j", "Bloom"]) AS output;
----
.Results
[opts="header"]
|===
| output
| "LIST OF STRING"
|===
[source,cypher]
----
CREATE (node1:Person)-[rel:FRIENDS]->(node2:Person)
RETURN apoc.meta.cypher.type(node1) AS node1Type,
apoc.meta.cypher.type(rel) AS relType,
apoc.meta.cypher.type(node2) AS node2Type;
----
.Results
[opts="header"]
|===
| node1Type | relType | node2Type
| "NODE" | "RELATIONSHIP" | "NODE"
|===
\ No newline at end of file
[source,cypher]
----
RETURN apoc.meta.cypher.types({
item1: 2,
item2: datetime(),
item3: "Michael"
}) AS output;
----
.Results
[opts="header"]
|===
| output
| {item2: "DATE_TIME", item1: "INTEGER", item3: "STRING"}
|===
The examples in this section are based on the following sample graph:
[source,cypher]
----
CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
CREATE (TomH:Person {name:'Tom Hanks', born:1956})
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
CREATE (TheMatrixReloaded:Movie {title:'The Matrix Reloaded', released:2003, tagline:'Free your mind'})
CREATE (TheMatrixRevolutions:Movie {title:'The Matrix Revolutions', released:2003, tagline:'Everything that has a beginning has an end'})
CREATE (SomethingsGottaGive:Movie {title:"Something's Gotta Give", released:2003})
CREATE (TheDevilsAdvocate:Movie {title:"The Devil's Advocate", released:1997, tagline:'Evil has its winning ways'})
CREATE (YouveGotMail:Movie {title:"You've Got Mail", released:1998, tagline:'At odds in life... in love on-line.'})
CREATE (SleeplessInSeattle:Movie {title:'Sleepless in Seattle', released:1993, tagline:'What if someone you never met, someone you never saw, someone you never knew was the only someone for you?'})
CREATE (ThatThingYouDo:Movie {title:'That Thing You Do', released:1996, tagline:'In every life there comes a time when that thing you dream becomes that thing you do'})
CREATE (CloudAtlas:Movie {title:'Cloud Atlas', released:2012, tagline:'Everything is connected'})
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixReloaded)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixRevolutions)
CREATE (Keanu)-[:ACTED_IN {roles:['Julian Mercer']}]->(SomethingsGottaGive)
CREATE (Keanu)-[:ACTED_IN {roles:['Kevin Lomax']}]->(TheDevilsAdvocate)
CREATE (TomH)-[:ACTED_IN {roles:['Joe Fox']}]->(YouveGotMail)
CREATE (TomH)-[:ACTED_IN {roles:['Sam Baldwin']}]->(SleeplessInSeattle)
CREATE (TomH)-[:ACTED_IN {roles:['Mr. White']}]->(ThatThingYouDo)
CREATE (TomH)-[:ACTED_IN {roles:['Zachry', 'Dr. Henry Goose', 'Isaac Sachs', 'Dermot Hoggins']}]->(CloudAtlas);
----
[source,cypher]
----
CALL apoc.meta.data();
----
.Results
[opts="header"]
|===
| label | property | count | unique | index | existence | type | array | sample | leftCount | rightCount | left | right | other | otherLabels | elementType
| "ACTED_IN" | "Person" | 9 | FALSE | FALSE | FALSE | "RELATIONSHIP" | TRUE | NULL | 41 | 9 | 4 | 1 | ["Movie"] | [] | "relationship"
| "ACTED_IN" | "roles" | 0 | FALSE | FALSE | FALSE | "LIST" | TRUE | NULL | 0 | 0 | 0 | 0 | [] | [] | "relationship"
| "Person" | "ACTED_IN" | 9 | FALSE | FALSE | FALSE | "RELATIONSHIP" | TRUE | NULL | 41 | 9 | 4 | 1 | ["Movie"] | [] | "node"
| "Person" | "name" | 0 | FALSE | FALSE | FALSE | "STRING" | FALSE | NULL | 0 | 0 | 0 | 0 | [] | [] | "node"
| "Person" | "born" | 0 | FALSE | FALSE | FALSE | "INTEGER" | FALSE | NULL | 0 | 0 | 0 | 0 | [] | [] | "node"
| "Movie" | "title" | 0 | FALSE | FALSE | FALSE | "STRING" | FALSE | NULL | 0 | 0 | 0 | 0 | [] | [] | "node"
| "Movie" | "tagline" | 0 | FALSE | FALSE | FALSE | "STRING" | FALSE | NULL | 0 | 0 | 0 | 0 | [] | [] | "node"
| "Movie" | "released" | 0 | FALSE | FALSE | FALSE | "INTEGER" | FALSE | NULL | 0 | 0 | 0 | 0 | [] | [] | "node"
|===
\ No newline at end of file
The examples in this section are based on the following sample graph:
[source,cypher]
----
CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
CREATE (TomH:Person {name:'Tom Hanks', born:1956})
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
CREATE (TheMatrixReloaded:Movie {title:'The Matrix Reloaded', released:2003, tagline:'Free your mind'})
CREATE (TheMatrixRevolutions:Movie {title:'The Matrix Revolutions', released:2003, tagline:'Everything that has a beginning has an end'})
CREATE (SomethingsGottaGive:Movie {title:"Something's Gotta Give", released:2003})
CREATE (TheDevilsAdvocate:Movie {title:"The Devil's Advocate", released:1997, tagline:'Evil has its winning ways'})
CREATE (YouveGotMail:Movie {title:"You've Got Mail", released:1998, tagline:'At odds in life... in love on-line.'})
CREATE (SleeplessInSeattle:Movie {title:'Sleepless in Seattle', released:1993, tagline:'What if someone you never met, someone you never saw, someone you never knew was the only someone for you?'})
CREATE (ThatThingYouDo:Movie {title:'That Thing You Do', released:1996, tagline:'In every life there comes a time when that thing you dream becomes that thing you do'})
CREATE (CloudAtlas:Movie {title:'Cloud Atlas', released:2012, tagline:'Everything is connected'})
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixReloaded)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixRevolutions)
CREATE (Keanu)-[:ACTED_IN {roles:['Julian Mercer']}]->(SomethingsGottaGive)
CREATE (Keanu)-[:ACTED_IN {roles:['Kevin Lomax']}]->(TheDevilsAdvocate)
CREATE (TomH)-[:ACTED_IN {roles:['Joe Fox']}]->(YouveGotMail)
CREATE (TomH)-[:ACTED_IN {roles:['Sam Baldwin']}]->(SleeplessInSeattle)
CREATE (TomH)-[:ACTED_IN {roles:['Mr. White']}]->(ThatThingYouDo)
CREATE (TomH)-[:ACTED_IN {roles:['Zachry', 'Dr. Henry Goose', 'Isaac Sachs', 'Dermot Hoggins']}]->(CloudAtlas);
----
[source,cypher]
----
CALL apoc.meta.graph()
----
image::apoc.meta.graph.png[title="Meta Graph"]
The examples in this section are based on the following sample graph:
[source,cypher]
----
CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
CREATE (TomH:Person {name:'Tom Hanks', born:1956})
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
CREATE (TheMatrixReloaded:Movie {title:'The Matrix Reloaded', released:2003, tagline:'Free your mind'})
CREATE (TheMatrixRevolutions:Movie {title:'The Matrix Revolutions', released:2003, tagline:'Everything that has a beginning has an end'})
CREATE (SomethingsGottaGive:Movie {title:"Something's Gotta Give", released:2003})
CREATE (TheDevilsAdvocate:Movie {title:"The Devil's Advocate", released:1997, tagline:'Evil has its winning ways'})
CREATE (YouveGotMail:Movie {title:"You've Got Mail", released:1998, tagline:'At odds in life... in love on-line.'})
CREATE (SleeplessInSeattle:Movie {title:'Sleepless in Seattle', released:1993, tagline:'What if someone you never met, someone you never saw, someone you never knew was the only someone for you?'})
CREATE (ThatThingYouDo:Movie {title:'That Thing You Do', released:1996, tagline:'In every life there comes a time when that thing you dream becomes that thing you do'})
CREATE (CloudAtlas:Movie {title:'Cloud Atlas', released:2012, tagline:'Everything is connected'})
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixReloaded)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixRevolutions)
CREATE (Keanu)-[:ACTED_IN {roles:['Julian Mercer']}]->(SomethingsGottaGive)
CREATE (Keanu)-[:ACTED_IN {roles:['Kevin Lomax']}]->(TheDevilsAdvocate)
CREATE (TomH)-[:ACTED_IN {roles:['Joe Fox']}]->(YouveGotMail)
CREATE (TomH)-[:ACTED_IN {roles:['Sam Baldwin']}]->(SleeplessInSeattle)
CREATE (TomH)-[:ACTED_IN {roles:['Mr. White']}]->(ThatThingYouDo)
CREATE (TomH)-[:ACTED_IN {roles:['Zachry', 'Dr. Henry Goose', 'Isaac Sachs', 'Dermot Hoggins']}]->(CloudAtlas);
----
[source,cypher]
----
CALL apoc.meta.graphSample()
----
image::apoc.meta.graph.png[title="Meta Graph"]
The examples in this section are based on the following sample graph:
[source,cypher]
----
CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
CREATE (TomH:Person {name:'Tom Hanks', born:1956})
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
CREATE (TheMatrixReloaded:Movie {title:'The Matrix Reloaded', released:2003, tagline:'Free your mind'})
CREATE (TheMatrixRevolutions:Movie {title:'The Matrix Revolutions', released:2003, tagline:'Everything that has a beginning has an end'})
CREATE (SomethingsGottaGive:Movie {title:"Something's Gotta Give", released:2003})
CREATE (TheDevilsAdvocate:Movie {title:"The Devil's Advocate", released:1997, tagline:'Evil has its winning ways'})
CREATE (YouveGotMail:Movie {title:"You've Got Mail", released:1998, tagline:'At odds in life... in love on-line.'})
CREATE (SleeplessInSeattle:Movie {title:'Sleepless in Seattle', released:1993, tagline:'What if someone you never met, someone you never saw, someone you never knew was the only someone for you?'})
CREATE (ThatThingYouDo:Movie {title:'That Thing You Do', released:1996, tagline:'In every life there comes a time when that thing you dream becomes that thing you do'})
CREATE (CloudAtlas:Movie {title:'Cloud Atlas', released:2012, tagline:'Everything is connected'})
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixReloaded)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixRevolutions)
CREATE (Keanu)-[:ACTED_IN {roles:['Julian Mercer']}]->(SomethingsGottaGive)
CREATE (Keanu)-[:ACTED_IN {roles:['Kevin Lomax']}]->(TheDevilsAdvocate)
CREATE (TomH)-[:ACTED_IN {roles:['Joe Fox']}]->(YouveGotMail)
CREATE (TomH)-[:ACTED_IN {roles:['Sam Baldwin']}]->(SleeplessInSeattle)
CREATE (TomH)-[:ACTED_IN {roles:['Mr. White']}]->(ThatThingYouDo)
CREATE (TomH)-[:ACTED_IN {roles:['Zachry', 'Dr. Henry Goose', 'Isaac Sachs', 'Dermot Hoggins']}]->(CloudAtlas);
----
[source,cypher]
----
CALL apoc.meta.schema()
YIELD value
UNWIND keys(value) AS key
RETURN key, value[key] AS value;
----
.Results
[opts="header"]
|===
| key | value
| "Movie" | {count: 9, relationships: {ACTED_IN: {count: 41, properties: {roles: {existence: FALSE, type: "LIST", array: TRUE}}, direction: "in", labels: ["Person"]}}, type: "node", properties: {tagline: {existence: FALSE, type: "STRING", indexed: FALSE, unique: FALSE}, title: {existence: FALSE, type: "STRING", indexed: FALSE, unique: FALSE}, released: {existence: FALSE, type: "INTEGER", indexed: FALSE, unique: FALSE}}, labels: []}
| "ACTED_IN" | {count: 9, type: "relationship", properties: {roles: {existence: FALSE, type: "LIST", array: TRUE}}}
| "Person" | {count: 2, relationships: {ACTED_IN: {count: 9, properties: {roles: {existence: FALSE, type: "LIST", array: TRUE}}, direction: "out", labels: ["Movie"]}}, type: "node", properties: {name: {existence: FALSE, type: "STRING", indexed: FALSE, unique: FALSE}, born: {existence: FALSE, type: "INTEGER", indexed: FALSE, unique: FALSE}}, labels: []}
|===
The examples in this section are based on the following sample graph:
[source,cypher]
----
CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
CREATE (TomH:Person {name:'Tom Hanks', born:1956})
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
CREATE (TheMatrixReloaded:Movie {title:'The Matrix Reloaded', released:2003, tagline:'Free your mind'})
CREATE (TheMatrixRevolutions:Movie {title:'The Matrix Revolutions', released:2003, tagline:'Everything that has a beginning has an end'})
CREATE (SomethingsGottaGive:Movie {title:"Something's Gotta Give", released:2003})
CREATE (TheDevilsAdvocate:Movie {title:"The Devil's Advocate", released:1997, tagline:'Evil has its winning ways'})
CREATE (YouveGotMail:Movie {title:"You've Got Mail", released:1998, tagline:'At odds in life... in love on-line.'})
CREATE (SleeplessInSeattle:Movie {title:'Sleepless in Seattle', released:1993, tagline:'What if someone you never met, someone you never saw, someone you never knew was the only someone for you?'})
CREATE (ThatThingYouDo:Movie {title:'That Thing You Do', released:1996, tagline:'In every life there comes a time when that thing you dream becomes that thing you do'})
CREATE (CloudAtlas:Movie {title:'Cloud Atlas', released:2012, tagline:'Everything is connected'})
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixReloaded)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixRevolutions)
CREATE (Keanu)-[:ACTED_IN {roles:['Julian Mercer']}]->(SomethingsGottaGive)
CREATE (Keanu)-[:ACTED_IN {roles:['Kevin Lomax']}]->(TheDevilsAdvocate)
CREATE (TomH)-[:ACTED_IN {roles:['Joe Fox']}]->(YouveGotMail)
CREATE (TomH)-[:ACTED_IN {roles:['Sam Baldwin']}]->(SleeplessInSeattle)
CREATE (TomH)-[:ACTED_IN {roles:['Mr. White']}]->(ThatThingYouDo)
CREATE (TomH)-[:ACTED_IN {roles:['Zachry', 'Dr. Henry Goose', 'Isaac Sachs', 'Dermot Hoggins']}]->(CloudAtlas);
----
[source,cypher]
----
CALL apoc.meta.stats();
----
.Results
[opts="header"]
|===
| labelCount | relTypeCount | propertyKeyCount | nodeCount | relCount | labels | relTypes | relTypesCount | stats
| 9 | 5 | 17 | 11 | 9 | {Movie: 9, Person: 2} | {`(:Person)-[:ACTED_IN]->()`: 9, `()-[:ACTED_IN]->(:Movie)`: 9, `()-[:ACTED_IN]->()`: 9} | {ACTED_IN: 9} | {relTypeCount: 5, propertyKeyCount: 17, labelCount: 9, nodeCount: 11, relCount: 9, labels: {Movie: 9, Person: 2}, relTypes: {`(:Person)-[:ACTED_IN]->()`: 9, `()-[:ACTED_IN]->(:Movie)`: 9, `()-[:ACTED_IN]->()`: 9}}
|===
\ No newline at end of file
The examples in this section are based on the following sample graph:
[source,cypher]
----
CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
CREATE (TomH:Person {name:'Tom Hanks', born:1956})
CREATE (LillyW:Person {name:'Lilly Wachowski', born:1967})
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
CREATE (TheMatrixReloaded:Movie {title:'The Matrix Reloaded', released:2003, tagline:'Free your mind'})
CREATE (TheMatrixRevolutions:Movie {title:'The Matrix Revolutions', released:2003, tagline:'Everything that has a beginning has an end'})
CREATE (SomethingsGottaGive:Movie {title:"Something's Gotta Give", released:2003})
CREATE (TheDevilsAdvocate:Movie {title:"The Devil's Advocate", released:1997, tagline:'Evil has its winning ways'})
CREATE (YouveGotMail:Movie {title:"You've Got Mail", released:1998, tagline:'At odds in life... in love on-line.'})
CREATE (SleeplessInSeattle:Movie {title:'Sleepless in Seattle', released:1993, tagline:'What if someone you never met, someone you never saw, someone you never knew was the only someone for you?'})
CREATE (ThatThingYouDo:Movie {title:'That Thing You Do', released:1996, tagline:'In every life there comes a time when that thing you dream becomes that thing you do'})
CREATE (CloudAtlas:Movie {title:'Cloud Atlas', released:2012, tagline:'Everything is connected'})
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixReloaded)
CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixRevolutions)
CREATE (Keanu)-[:ACTED_IN {roles:['Julian Mercer']}]->(SomethingsGottaGive)
CREATE (Keanu)-[:ACTED_IN {roles:['Kevin Lomax']}]->(TheDevilsAdvocate)
CREATE (TomH)-[:ACTED_IN {roles:['Joe Fox']}]->(YouveGotMail)
CREATE (TomH)-[:ACTED_IN {roles:['Sam Baldwin']}]->(SleeplessInSeattle)
CREATE (TomH)-[:ACTED_IN {roles:['Mr. White']}]->(ThatThingYouDo)
CREATE (TomH)-[:ACTED_IN {roles:['Zachry', 'Dr. Henry Goose', 'Isaac Sachs', 'Dermot Hoggins']}]->(CloudAtlas)
CREATE (LillyW)-[:DIRECTED]->(TheMatrix);
----
[source,cypher]
----
CALL apoc.meta.subGraph({
includeLabels: ["Person", "Movie"],
includeRels: ["DIRECTED"]
});
----
image::apoc.meta.subGraph-filter.png[title="Meta Sub Graph"]
The procedure support the following config parameters:
.Config parameters
[opts=header]
|===
| name | type | default | description
| includeLabels | List<String> | [] | labels to include. Default is to include all labels
| includeRels | List<String> | [] | relationship types to include. Default is to include all relationship types
| excludesLabels | List<String> | [] | labels to include. Default is to include all relationship types
| sample | Long | 1000 | number of nodes to sample per label
| maxRels | Long | 100 | number of relationships to sample per relationship type
|===
.Deprecated parameters
[opts=header]
|===
| name | type | default | description
| labels | List<String> | [] | deprecated, use `includeLabels`
| rels | List<String> | [] | deprecated, use `includeRels`
| excludes | List<String> | [] | deprecated, use `excludesLabels`
|===
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册