query

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// codelists
	GetCodeLists       = "MATCH (i) WHERE i:_code_list%s RETURN distinct labels(i) as labels"
	GetCodeList        = "MATCH (i:_code_list:`_code_list_%s`) RETURN i"
	GetCodeListEdition = "MATCH (i:_code_list:`_code_list_%s` {edition:" + `"%s"` + "}) RETURN i"
	CountEditions      = "MATCH (cl:_code_list:`_code_list_%s`) WHERE cl.edition = %q RETURN count(*)"
	GetCodes           = "MATCH (c:_code) -[r:usedBy]->(cl:_code_list: `_code_list_%s`) WHERE cl.edition = %q RETURN c, r"
	GetCode            = "MATCH (c:_code) -[r:usedBy]->(cl:_code_list: `_code_list_%s`) WHERE cl.edition = %q AND c.value = %q RETURN c, r"
	GetCodeDatasets    = "MATCH (d)<-[inDataset]-(c:_code)-[r:usedBy]->(cl:_code_list:`_code_list_%s`) WHERE (cl.edition=" + `"%s"` + ") AND (c.value=" + `"%s"` + ") AND (d.is_published=true) RETURN d,r"

	// hierarchy write
	CreateHierarchyConstraint    = "CREATE CONSTRAINT ON (n:`_hierarchy_node_%s_%s`) ASSERT n.code IS UNIQUE;"
	CloneHierarchyNodes          = "" /* 146-byte string literal not displayed */
	CountHierarchyNodes          = "MATCH (n:`_hierarchy_node_%s_%s`) RETURN COUNT(n);"
	CloneHierarchyRelationships  = "" /* 303-byte string literal not displayed */
	SetNumberOfChildren          = "MATCH (n:`_hierarchy_node_%s_%s`) with n SET n.numberOfChildren = size((n)<-[:hasParent]-(:`_hierarchy_node_%s_%s`))"
	SetHasData                   = "MATCH (n:`_hierarchy_node_%s_%s`), (p:`_%s_%s`) WHERE n.code = p.value SET n.hasData=true"
	MarkNodesToRemain            = "" /* 155-byte string literal not displayed */
	RemoveNodesNotMarkedToRemain = "MATCH (node:`_hierarchy_node_%s_%s`) WHERE NOT EXISTS(node.remain) DETACH DELETE node"
	RemoveRemainMarker           = "MATCH (node:`_hierarchy_node_%s_%s`) REMOVE node.remain"

	// hierarchy read
	HierarchyExists     = "MATCH (i:`_hierarchy_node_%s_%s`) RETURN i LIMIT 1"
	GetHierarchyRoot    = "MATCH (i:`_hierarchy_node_%s_%s`) WHERE NOT (i)-[:hasParent]->() RETURN i LIMIT 1"
	GetHierarchyElement = "MATCH (i:`_hierarchy_node_%s_%s` {code:{code}}) RETURN i"
	GetChildren         = "MATCH (i:`_hierarchy_node_%s_%s` {code:{code}})<-[r:hasParent]-(child) RETURN child ORDER BY child.label"
	GetAncestry         = "MATCH (i:`_hierarchy_node_%s_%s` {code:{code}})-[r:hasParent *]->(parent) RETURN parent"

	// instance - import process
	CreateInstanceObservationConstraint = "CREATE CONSTRAINT ON (o:`_%s_observation`) ASSERT o.rowIndex IS UNIQUE"
	CreateInstance                      = "CREATE (i:`_%s_Instance` { header:'%s'}) RETURN i"
	CountInstance                       = "MATCH (i: `_%s_Instance`) RETURN COUNT(*)"
	AddInstanceDimensions               = "MATCH (i:`_%s_Instance`) SET i.dimensions = {dimensions_list}"
	CreateInstanceToCodeRelationship    = "MATCH (i:`_%s_Instance`), (c:_code {value:{code}})-[:usedBy]->(cl:`_code_list_%s`) CREATE (c)-[:inDataset]->(i)"
	AddVersionDetailsToInstance         = "MATCH (i:`_%s_Instance`) SET i.dataset_id = {dataset_id}, i.edition = {edition}, i.version = {version} RETURN i"
	SetInstanceIsPublished              = "MATCH (i:`_%s_Instance`) SET i.is_published = true"
	CountObservations                   = "MATCH (o:`_%s_observation`) RETURN COUNT(o)"

	// dimension
	CreateDimensionConstraint             = "CREATE CONSTRAINT ON (d:`_%s_%s`) ASSERT d.value IS UNIQUE" //dimensionLabel "_%s_%s" = i.InstanceID, d.DimensionID
	CreateDimensionToInstanceRelationship = "MATCH (i:`_%s_Instance`) CREATE (d:`_%s_%s` {value: {value}}) CREATE (i)-[:HAS_DIMENSION]->(d) RETURN ID(d)"
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL