Skip to content

Commit

Permalink
Getting more cypher docs to split off untranslatable content into sep…
Browse files Browse the repository at this point in the history
…arate files.
  • Loading branch information
nawroth committed Oct 25, 2012
1 parent c79e9c5 commit 2c86946
Show file tree
Hide file tree
Showing 32 changed files with 87 additions and 70 deletions.
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/aggregation/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ include::introduction.asciidoc[]

The following examples are assuming the example graph structure below.

include::cypher-aggregation-graph.asciidoc[]
.Graph
include::includes/cypher-aggregation-graph.asciidoc[]

== COUNT ==
+COUNT+ is used to count the number of rows. +COUNT+ can be used in two forms -- `COUNT(*)`
Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/cookbook/activity-streams.asciidoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[[domain-modeling-activity-streams]]
== Activity Streams ==

include::cypher-graphity-graph.asciidoc[]
.Graph
include::includes/cypher-graphity-graph.asciidoc[]

include::find-activity-streams-in-a-network-without-scaling-penalty.asciidoc[]

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

:leveloffset: 2

include::cypher-boostingrecommendationresults-graph.asciidoc[]
.Graph
include::includes/cypher-boostingrecommendationresults-graph.asciidoc[]

include::boosting-with-properties-on-relationships.asciidoc[]

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

:leveloffset: 2

include::cypher-clusteringcoefficient-graph.asciidoc[]
.Graph
include::includes/cypher-clusteringcoefficient-graph.asciidoc[]

include::calculating-the-clustering-coefficient-of-a-friend-network.asciidoc[]

3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/cookbook/co-favorited-places.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

:leveloffset: 2

include::cypher-cofavoritedplaces-graph.asciidoc[]
.Graph
include::includes/cypher-cofavoritedplaces-graph.asciidoc[]

include::co-favorited-places----users-who-like-x-also-like-y.asciidoc[]

Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/cookbook/friend-finding.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

Imagine an example graph like the following one:

include::cypher-collabfiltering-graph.asciidoc[]
.Graph
include::includes/cypher-collabfiltering-graph.asciidoc[]

:leveloffset: 2

Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/cookbook/graphity.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

include::find-activity-streams-in-a-network-without-scaling-penalty.asciidoc[]

include::cypher-graphity-graph.asciidoc[]
.Graph
include::includes/cypher-graphity-graph.asciidoc[]

3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/cookbook/hyperedges.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ He also can have different roles in different groups apart from the membership.
The association of a User, a Group and a Role can be referred to as a _HyperEdge_.
However, it can be easily modeled in a property graph as a node that captures this n-ary relationship, as depicted below in the +U1G2R1+ node.

include::cypher-hyperedge-graph.asciidoc[]
.Graph
include::includes/cypher-hyperedge-graph.asciidoc[]

:leveloffset: 2

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

.Graph
["dot", "cypher-pathtree-layout-full-range-path.svg", "neoviz"]
----
root [label="Root"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

.Graph
["dot", "cypher-pathtree-layout-shared-root-path.svg", "neoviz"]
----
root [label="Root"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

.Graph
["dot", "cypher-pathtree-layout-zero-range.svg", "neoviz"]
----
root [label="Root"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

.Graph
["dot", "cypher-pathtree-layout-path.svg", "neoviz"]
----
root [label="Root"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

:leveloffset: 2

include::cypher-multirelationalsocialnetwork-graph.asciidoc[]
.Graph
include::includes/cypher-multirelationalsocialnetwork-graph.asciidoc[]

include::who-follows-or-loves-me-back.asciidoc[]

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

:leveloffset: 2

include::cypher-mutualfriendsandgroups-graph.asciidoc[]
.Graph
include::includes/cypher-mutualfriendsandgroups-graph.asciidoc[]

include::find-mutual-friends-and-groups.asciidoc[]

3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/cookbook/path-tree.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ The graph below depicts a structure with 3 Events being attached to an index str

:leveloffset: 2

include::path-tree-layout.asciidoc[]
.Graph
include::includes/path-tree-layout.asciidoc[]

include::return-zero-range.asciidoc[]

Expand Down
12 changes: 8 additions & 4 deletions cypher/src/docs/dev/ql/cookbook/pretty-graphs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ This section is showing how to create some of the http://en.wikipedia.org/wiki/G

include::star-graph.asciidoc[]

include::cypher-prettygraphsstar-graph.asciidoc[]
.Graph
include::includes/cypher-prettygraphsstar-graph.asciidoc[]

:leveloffset: 2

include::wheel-graph.asciidoc[]

include::cypher-prettygraphswheel-graph.asciidoc[]
.Graph
include::includes/cypher-prettygraphswheel-graph.asciidoc[]

:leveloffset: 2

include::complete-graph.asciidoc[]

include::cypher-prettygraphscompletegraph-graph.asciidoc[]
.Graph
include::includes/cypher-prettygraphscompletegraph-graph.asciidoc[]

:leveloffset: 2

include::friendship-graph.asciidoc[]

include::cypher-prettygraphsfriendshipgraph-graph.asciidoc[]
.Graph
include::includes/cypher-prettygraphsfriendshipgraph-graph.asciidoc[]


3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/cookbook/similar-favorites.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

:leveloffset: 2

include::cypher-peoplesimilarityfavorites-graph.asciidoc[]
.Graph
include::includes/cypher-peoplesimilarityfavorites-graph.asciidoc[]

include::find-people-based-on-similar-favorites.asciidoc[]

3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/cookbook/similar-tags.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

:leveloffset: 2

include::cypher-peoplesimilaritytags-graph.asciidoc[]
.Graph
include::includes/cypher-peoplesimilaritytags-graph.asciidoc[]

include::find-people-based-on-similar-tagged-favorties.asciidoc[]

Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/cookbook/similarity-complex.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

include::calculate-similarities-by-complex-calculations.asciidoc[]

include::cypher-complexsimilarity-graph.asciidoc[]
.Graph
include::includes/cypher-complexsimilarity-graph.asciidoc[]

3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/functions/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Most functions in Cypher will return +null+ if the input parameter is +null+.

Here is a list of the functions in Cypher, seperated into three different sections: Predicates, Scalar functions and Aggregated functions

include::cypher-functions-graph.asciidoc[]
.Graph
include::includes/cypher-functions-graph.asciidoc[]

:leveloffset: 2

Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/limit/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Limit

+LIMIT+ enables the return of only subsets of the total result.

include::cypher-limit-graph.asciidoc[]
.Graph
include::includes/cypher-limit-graph.asciidoc[]

include::return-first-part.asciidoc[]
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/match/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Read <<introduction-pattern>> for an introduction.

The following graph is used for the examples below:

include::cypher-match-graph.asciidoc[]
.Graph
include::includes/cypher-match-graph.asciidoc[]

include::related-nodes.asciidoc[]

Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/order-by/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Order by
To sort the output, use the +ORDER BY+ clause. Note that you can not sort on nodes or relationships,
just on properties on these.

include::cypher-orderby-graph.asciidoc[]
.Graph
include::includes/cypher-orderby-graph.asciidoc[]

include::order-nodes-by-property.asciidoc[]

Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/return/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Return
In the `RETURN` part of your query, you define which parts of the pattern you are
interested in. It can be nodes, relationships, or properties on these.

include::cypher-return-graph.asciidoc[]
.Graph
include::includes/cypher-return-graph.asciidoc[]

include::return-nodes.asciidoc[]

Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/skip/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Skip
By using +SKIP+, the result set will get trimmed from the top.
Please note that no guarantees are made on the order of the result unless the query specifies the +ORDER BY+ clause.

include::cypher-skip-graph.asciidoc[]
.Graph
include::includes/cypher-skip-graph.asciidoc[]

include::skip-first-three.asciidoc[]

Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/start/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ You can either introduce starting points by id, or by
index lookups. Note that trying to use an index that doesn't exist will throw
an exception.

include::cypher-start-graph.asciidoc[]
.Graph
include::includes/cypher-start-graph.asciidoc[]

include::node-by-id.asciidoc[]

Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/where/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Where
If you need filtering apart from the pattern of the data that you are looking
for, you can add clauses in the `WHERE` part of the query.

include::cypher-where-graph.asciidoc[]
.Graph
include::includes/cypher-where-graph.asciidoc[]

include::boolean-operations.asciidoc[]

Expand Down
3 changes: 2 additions & 1 deletion cypher/src/docs/dev/ql/with/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ used to pipe the result from one query to the next.

+WITH+ is also used to separate reading from updating of the graph. Every sub-query of a query must be either read-only or write-only.

include::cypher-with-graph.asciidoc[]
.Graph
include::includes/cypher-with-graph.asciidoc[]

include::filter-on-aggregate-function-results.asciidoc[]

Expand Down
18 changes: 8 additions & 10 deletions cypher/src/test/scala/org/neo4j/cypher/docgen/ArticleTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
var relIndex: Index[Relationship] = null
val properties: Map[String, Map[String, Any]] = Map()
var generateConsole: Boolean = true
var dir: File = null

def title: String
def section: String
def assert(name: String, result: ExecutionResult)
def graphDescription: List[String]
def indexProps: List[String] = List()

def executeQuery(queryText: String)(implicit engine: ExecutionEngine): ExecutionResult = try {
val result = engine.execute(replaceNodeIds(queryText))
result.toList //Let's materialize the result
Expand Down Expand Up @@ -97,6 +98,7 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
val querySnippet = AsciiDocGenerator.dumpToSeparateFileWithType(dir, name + "-query", queryAsciidoc)
val consoleAsciidoc = consoleSnippet(replaceNodeIds(query), emptyGraph)
val consoleText = if (!consoleAsciidoc.isEmpty)
".Try this query live\n" +
AsciiDocGenerator.dumpToSeparateFileWithType(dir, name + "-console", consoleAsciidoc)
else ""
val queryOutput = runQuery(emptyGraph, query, possibleAssertion)
Expand Down Expand Up @@ -144,8 +146,7 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
private def consoleSnippet(query: String, empty: Boolean): String = {
if (generateConsole) {
val create = if (!empty) new GeoffService(db).toGeoff.trim else "start n=node(*) match n-[r?]->() delete n, r;"
""".Try this query live
[console]
"""[console]
----
%s
Expand All @@ -161,7 +162,7 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
def produceDocumentation() {
val db = init()
try {
val (dir: File, writer: PrintWriter) = createWriter(title, section)
val writer: PrintWriter = createWriter(title, dir)

val queryText = includeQueries(text, dir)

Expand All @@ -176,17 +177,13 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
val assertiongRegEx = "assertion=([^\\s]*)".r

private def includeGraphviz(startText: String, dir: File):String = {
val graphVizLine = "include::" + graphvizFileName + "[]"

val regex = "###graph-image(.*?)###".r
regex.findFirstMatchIn(startText) match {
case None => startText
case Some(options) =>
val optionString = options.group(1)
val txt = startText.replaceAllLiterally("###graph-image" + optionString + "###", graphVizLine)
if (txt != startText) {
dumpGraphViz(dir, optionString.trim)
}
val txt = startText.replaceAllLiterally("###graph-image" + optionString + "###",
dumpGraphViz(dir, optionString.trim))
txt
}
}
Expand Down Expand Up @@ -215,6 +212,7 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
}

private def init() = {
dir = createDir(section)
db = new TestGraphDatabaseFactory().newImpermanentDatabaseBuilder().newGraphDatabase()

db.asInstanceOf[ImpermanentGraphDatabase].cleanContent(false)
Expand Down
Loading

0 comments on commit 2c86946

Please sign in to comment.