├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── LICENSES.txt ├── NOTICE.txt ├── README.adoc ├── ast-factory ├── LICENSES.txt ├── NOTICE.txt ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── opencypher │ └── v9_0 │ └── ast │ └── factory │ ├── ASTExceptionFactory.java │ ├── ASTExpressionFactory.java │ ├── ASTFactory.java │ ├── AccessType.java │ ├── ActionType.java │ ├── ConstraintType.java │ ├── ConstraintVersion.java │ ├── CreateIndexTypes.java │ ├── HintIndexType.java │ ├── ParameterType.java │ ├── ScopeType.java │ ├── ShowCommandFilterTypes.java │ └── SimpleEither.java ├── ast ├── LICENSE.txt ├── LICENSES.txt ├── NOTICE.txt ├── pom.xml └── src │ ├── main │ └── scala │ │ └── org │ │ └── opencypher │ │ └── v9_0 │ │ ├── ast │ │ ├── ASTAnnotationMap.scala │ │ ├── ASTSlicingPhrase.scala │ │ ├── ActionResource.scala │ │ ├── AdministrationAction.scala │ │ ├── AdministrationCommand.scala │ │ ├── AmbiguousAggregation.scala │ │ ├── CatalogName.scala │ │ ├── Clause.scala │ │ ├── ConstraintVersion.scala │ │ ├── DatabaseName.scala │ │ ├── Hint.scala │ │ ├── IfExistsDo.scala │ │ ├── Limit.scala │ │ ├── MergeAction.scala │ │ ├── Options.scala │ │ ├── Order.scala │ │ ├── PrivilegeQualifier.scala │ │ ├── PrivilegeType.scala │ │ ├── ProcedureResult.scala │ │ ├── ProcedureResultItem.scala │ │ ├── Query.scala │ │ ├── RemoveItem.scala │ │ ├── ReturnItem.scala │ │ ├── RevokeType.scala │ │ ├── SchemaCommand.scala │ │ ├── Scope.scala │ │ ├── SetItem.scala │ │ ├── ShowColumn.scala │ │ ├── ShowConstraintTypes.scala │ │ ├── ShowExecutableBy.scala │ │ ├── ShowFunctionTypes.scala │ │ ├── ShowIndexTypes.scala │ │ ├── Skip.scala │ │ ├── Statement.scala │ │ ├── StatementWithGraph.scala │ │ ├── Where.scala │ │ ├── connectedComponents.scala │ │ ├── package.scala │ │ ├── prettifier │ │ │ ├── ExpressionStringifier.scala │ │ │ ├── PathStepStringifier.scala │ │ │ ├── PatternStringifier.scala │ │ │ ├── Prettifier.scala │ │ │ └── PrettyExpressionStringifier.scala │ │ └── semantics │ │ │ ├── ScopeTreeVerifier.scala │ │ │ ├── SemanticAnalysisTooling.scala │ │ │ ├── SemanticCheck.scala │ │ │ ├── SemanticCheckInterpreter.scala │ │ │ ├── SemanticChecker.scala │ │ │ ├── SemanticError.scala │ │ │ ├── SemanticExpressionCheck.scala │ │ │ ├── SemanticFeature.scala │ │ │ ├── SemanticFunctionCheck.scala │ │ │ ├── SemanticPatternCheck.scala │ │ │ ├── SemanticState.scala │ │ │ ├── SemanticTable.scala │ │ │ └── package.scala │ │ └── logical │ │ └── plans │ │ └── CoerceToPredicate.scala │ └── test │ └── scala │ └── org │ └── opencypher │ └── v9_0 │ └── ast │ ├── ASTAnnotationMapTest.scala │ ├── ASTNodeTest.scala │ ├── AdministrationCommandTest.scala │ ├── AstConstructionTestSupport.scala │ ├── ClauseTest.scala │ ├── ConnectedComponentsTest.scala │ ├── ConstantExpressionTest.scala │ ├── ContainsAggregateTest.scala │ ├── ExpressionCallTypeCheckerTest.scala │ ├── ExpressionTest.scala │ ├── FindDuplicateRelationshipsTest.scala │ ├── FunctionNameTest.scala │ ├── IsAggregateTest.scala │ ├── LoadCSVTest.scala │ ├── OrderTest.scala │ ├── ProjectionClauseTest.scala │ ├── ReturnItemsTest.scala │ ├── SetClauseTest.scala │ ├── StatementHelper.scala │ ├── generator │ ├── AstGenerator.scala │ ├── AstShrinker.scala │ └── SemanticAwareAstGenerator.scala │ ├── prettifier │ ├── ExpressionStringifierTest.scala │ ├── PathStepStringifierTest.scala │ └── PatternStringifierTest.scala │ └── semantics │ ├── AddTest.scala │ ├── AndTest.scala │ ├── AndsTest.scala │ ├── ContainerIndexTest.scala │ ├── ContainsTest.scala │ ├── CountTest.scala │ ├── DivideTest.scala │ ├── EndsWithTest.scala │ ├── ExistsTest.scala │ ├── FilteringExpressionTest.scala │ ├── HexIntegerLiteralTest.scala │ ├── InequalityExpressionTestBase.scala │ ├── InfixExpressionTestBase.scala │ ├── ListComprehensionTest.scala │ ├── ListSliceTest.scala │ ├── LiteralTest.scala │ ├── ModuloTest.scala │ ├── MultiplyTest.scala │ ├── OctalIntegerLiteralTest.scala │ ├── OrTest.scala │ ├── OrsTest.scala │ ├── PatternComprehensionTest.scala │ ├── PowTest.scala │ ├── PropertyTest.scala │ ├── ReduceExpressionTest.scala │ ├── ScopeTest.scala │ ├── ScopeTestHelper.scala │ ├── ScopeTreeVerifierTest.scala │ ├── SemanticAnalysisToolingTest.scala │ ├── SemanticCaseExpressionTest.scala │ ├── SemanticCheckableTest.scala │ ├── SemanticFunSuite.scala │ ├── SemanticStateTest.scala │ ├── ShortestPathExpressionTest.scala │ ├── StartsWithTest.scala │ ├── SubqueryCallTest.scala │ ├── SubtractTest.scala │ ├── TestExpression.scala │ ├── UnaryAddTest.scala │ ├── UnaryExpressionTestBase.scala │ ├── UnarySubtractTest.scala │ ├── VariableTest.scala │ ├── XorTest.scala │ └── functions │ ├── AbsTest.scala │ ├── AggregationFunctionTest.scala │ ├── CoalesceTest.scala │ ├── DistanceTest.scala │ ├── FunctionTestBase.scala │ ├── IsNaNTest.scala │ ├── LabelsTest.scala │ ├── PercentileContTest.scala │ ├── PercentileDiscTest.scala │ ├── PointTest.scala │ ├── ReverseTest.scala │ ├── SplitTest.scala │ ├── ToBooleanListTest.scala │ ├── ToBooleanOrNullTest.scala │ ├── ToBooleanTest.scala │ ├── ToFloatListTest.scala │ ├── ToFloatOrNullTest.scala │ ├── ToFloatTest.scala │ ├── ToIntegerListTest.scala │ ├── ToIntegerOrNullTest.scala │ ├── ToIntegerTest.scala │ ├── ToStringListTest.scala │ ├── ToStringOrNullTest.scala │ └── ToStringTest.scala ├── build ├── configs │ ├── ASL-2-header.txt │ ├── Apache Software License, Version 2.0 │ ├── BSD - Scala License │ ├── BSD License │ ├── BSD License 2-clause │ ├── Eclipse Public License - v 1.0 │ ├── Eclipse Public License v2.0 │ ├── MIT License │ ├── licensing-requirements-frontend.xml │ └── list-prefix.txt └── pom.xml ├── cypher-macros ├── LICENSE.txt ├── LICENSES.txt ├── NOTICE.txt ├── pom.xml └── src │ ├── main │ └── scala │ │ └── org │ │ └── opencypher │ │ └── v9_0 │ │ └── macros │ │ ├── AssertMacros.scala │ │ └── TranslateExceptionMacros.scala │ └── test │ └── scala │ └── org │ └── opencypher │ └── v9_0 │ └── macros │ └── RequireTest.scala ├── expressions ├── LICENSE.txt ├── LICENSES.txt ├── NOTICE.txt ├── pom.xml └── src │ ├── main │ └── scala │ │ └── org │ │ └── opencypher │ │ └── v9_0 │ │ └── expressions │ │ ├── AndedPropertyInequalities.scala │ │ ├── ArithmeticExpressions.scala │ │ ├── CachedProperty.scala │ │ ├── CanonicalStringHelper.scala │ │ ├── CaseExpression.scala │ │ ├── CoerceTo.scala │ │ ├── CollectAll.scala │ │ ├── ConstantExpression.scala │ │ ├── CountExpression.scala │ │ ├── CountStar.scala │ │ ├── ExistsExpression.scala │ │ ├── Expression.scala │ │ ├── FunctionInvocation.scala │ │ ├── FunctionTypeSignature.scala │ │ ├── GetDegree.scala │ │ ├── GraphPatternQuantifier.scala │ │ ├── HasLabels.scala │ │ ├── ImplicitProcedureArgument.scala │ │ ├── IsAggregate.scala │ │ ├── IterableExpressions.scala │ │ ├── LabelExpression.scala │ │ ├── ListLiteral.scala │ │ ├── Literal.scala │ │ ├── LogicalProperty.scala │ │ ├── LogicalVariable.scala │ │ ├── MapExpression.scala │ │ ├── MapProjection.scala │ │ ├── NameToken.scala │ │ ├── OperatorExpression.scala │ │ ├── Parameter.scala │ │ ├── PathExpression.scala │ │ ├── Pattern.scala │ │ ├── PatternExpression.scala │ │ ├── PredicateExpressions.scala │ │ ├── Property.scala │ │ ├── Range.scala │ │ ├── ScopeExpression.scala │ │ ├── SemanticDirection.scala │ │ ├── ShortestPathExpression.scala │ │ ├── SubqueryExpression.scala │ │ ├── SymbolicName.scala │ │ ├── TypeSignatures.scala │ │ ├── Variable.scala │ │ ├── containsAggregate.scala │ │ └── functions │ │ ├── Abs.scala │ │ ├── Acos.scala │ │ ├── Asin.scala │ │ ├── Atan.scala │ │ ├── Atan2.scala │ │ ├── Avg.scala │ │ ├── Ceil.scala │ │ ├── Coalesce.scala │ │ ├── Collect.scala │ │ ├── Cos.scala │ │ ├── Cot.scala │ │ ├── Count.scala │ │ ├── Degrees.scala │ │ ├── Distance.scala │ │ ├── E.scala │ │ ├── ElementId.scala │ │ ├── EndNode.scala │ │ ├── Exists.scala │ │ ├── Exp.scala │ │ ├── File.scala │ │ ├── Floor.scala │ │ ├── Function.scala │ │ ├── Haversin.scala │ │ ├── Head.scala │ │ ├── Id.scala │ │ ├── IsEmpty.scala │ │ ├── IsNaN.scala │ │ ├── Keys.scala │ │ ├── LTrim.scala │ │ ├── Labels.scala │ │ ├── Last.scala │ │ ├── Left.scala │ │ ├── Length.scala │ │ ├── Linenumber.scala │ │ ├── Log.scala │ │ ├── Log10.scala │ │ ├── Max.scala │ │ ├── Min.scala │ │ ├── Nodes.scala │ │ ├── PercentileCont.scala │ │ ├── PercentileDisc.scala │ │ ├── Pi.scala │ │ ├── Point.scala │ │ ├── Properties.scala │ │ ├── RTrim.scala │ │ ├── Radians.scala │ │ ├── Rand.scala │ │ ├── RandomUUID.scala │ │ ├── Range.scala │ │ ├── Reduce.scala │ │ ├── Relationships.scala │ │ ├── Replace.scala │ │ ├── Reverse.scala │ │ ├── Right.scala │ │ ├── Round.scala │ │ ├── Sign.scala │ │ ├── Sin.scala │ │ ├── Size.scala │ │ ├── Split.scala │ │ ├── Sqrt.scala │ │ ├── StartNode.scala │ │ ├── StdDev.scala │ │ ├── StdDevP.scala │ │ ├── Substring.scala │ │ ├── Sum.scala │ │ ├── Tail.scala │ │ ├── Tan.scala │ │ ├── ToBoolean.scala │ │ ├── ToBooleanList.scala │ │ ├── ToBooleanOrNull.scala │ │ ├── ToFloat.scala │ │ ├── ToFloatList.scala │ │ ├── ToFloatOrNull.scala │ │ ├── ToInteger.scala │ │ ├── ToIntegerList.scala │ │ ├── ToIntegerOrNull.scala │ │ ├── ToLower.scala │ │ ├── ToString.scala │ │ ├── ToStringList.scala │ │ ├── ToStringOrNull.scala │ │ ├── ToUpper.scala │ │ ├── Trim.scala │ │ ├── Type.scala │ │ ├── UnresolvedFunction.scala │ │ ├── UserDefinedFunctionInvocation.scala │ │ └── WithinBBox.scala │ └── test │ └── scala │ └── org │ └── opencypher │ └── v9_0 │ └── expressions │ ├── DummyExpression.scala │ ├── ExpressionCanonicalStringValTest.scala │ ├── LabelExpressionTest.scala │ └── VariableTest.scala ├── frontend ├── LICENSE.txt ├── LICENSES.txt ├── NOTICE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── opencypher │ │ │ └── v9_0 │ │ │ └── frontend │ │ │ └── phases │ │ │ └── CompilationPhaseTracer.java │ └── scala │ │ └── org │ │ └── opencypher │ │ └── v9_0 │ │ └── frontend │ │ ├── PlannerName.scala │ │ ├── helpers │ │ ├── SeqCombiner.scala │ │ └── package.scala │ │ └── phases │ │ ├── ASTRewriter.scala │ │ ├── AmbiguousAggregationAnalysis.scala │ │ ├── AstRewriting.scala │ │ ├── BaseContains.scala │ │ ├── BaseContext.scala │ │ ├── BaseState.scala │ │ ├── ExpandStarRewriter.scala │ │ ├── LiteralExtraction.scala │ │ ├── Monitors.scala │ │ ├── Namespacer.scala │ │ ├── ObfuscationMetadataCollection.scala │ │ ├── Phase.scala │ │ ├── PreparatoryRewriting.scala │ │ ├── ProjectNamedPathsRewriter.scala │ │ ├── SemanticAnalysis.scala │ │ ├── SemanticTypeCheck.scala │ │ ├── StatementCondition.scala │ │ ├── StatementRewriter.scala │ │ ├── SyntaxDeprecationWarningsAndReplacements.scala │ │ ├── Transformer.scala │ │ ├── collapseMultipleInPredicates.scala │ │ ├── extractSensitiveLiterals.scala │ │ ├── factories │ │ └── PlanPipelineTransformerFactory.scala │ │ ├── isolateAggregation.scala │ │ ├── rewriting │ │ └── cnf │ │ │ ├── CNFNormalizer.scala │ │ │ ├── deMorganRewriter.scala │ │ │ ├── distributeLawsRewriter.scala │ │ │ ├── flattenBooleanOperators.scala │ │ │ ├── mergeDuplicateBooleanOperators.scala │ │ │ ├── normalizeInequalities.scala │ │ │ ├── normalizeSargablePredicates.scala │ │ │ ├── rewriteEqualityToInPredicate.scala │ │ │ └── simplifyPredicates.scala │ │ └── transitiveClosure.scala │ └── test │ └── scala │ └── org │ └── opencypher │ └── v9_0 │ └── frontend │ ├── FoldableTest.scala │ ├── InputDataStreamSemanticAnalysisTest.scala │ ├── LabelExpressionSemanticAnalysisTest.scala │ ├── PatternExpressionSemanticAnalysisTest.scala │ ├── QuantifiedPathPatternsSemanticAnalysisTest.scala │ ├── RepeatTest.scala │ ├── ScopeTreeTest.scala │ ├── SemanticAnalysisTest.scala │ ├── SemanticAnalysisTestSuite.scala │ ├── SemanticScopeRecordingTest.scala │ ├── SemanticTypeCheckTest.scala │ ├── helpers │ ├── InputDataStreamTestInitialState.scala │ ├── NonEmptyListTest.scala │ ├── SemanticAnalysisTestSupport.scala │ ├── SeqCombinerTest.scala │ ├── StringHelperTest.scala │ ├── TestContext.scala │ └── TestState.scala │ ├── phases │ ├── ContextHelper.scala │ ├── NamespacerTest.scala │ ├── OpenCypherJavaCCParsing.scala │ ├── ReplaceDeprecatedCypherSyntaxTest.scala │ ├── RewriteEqualityToInPredicateTest.scala │ ├── RewritePhaseTest.scala │ ├── SyntaxDeprecationWarningsAndReplacementsTest.scala │ ├── TransformerTest.scala │ ├── TransitiveClosureTest.scala │ ├── extractSensitiveLiteralsTest.scala │ └── rewriting │ │ ├── CollapseInCollectionsTest.scala │ │ ├── CollapseMultipleInPredicatesTest.scala │ │ ├── IsolateAggregationTest.scala │ │ ├── MergeBooleanOperatorsTest.scala │ │ ├── cnf │ │ ├── CNFNormalizerTest.scala │ │ ├── DeMorganRewriterTest.scala │ │ ├── DistributeLawRewriterTest.scala │ │ ├── FlattenBooleanOperatorsTest.scala │ │ ├── NormalizeInequalitiesTest.scala │ │ ├── NormalizeSargablePredicatesTest.scala │ │ └── SimplifyPredicatesTest.scala │ │ ├── mergeInPredicatesTest.scala │ │ └── normalizeExistsPatternExpressionsTest.scala │ ├── prettifier │ ├── ExpressionStringifierIT.scala │ ├── PrettifierIT.scala │ ├── PrettifierPropertyTest.scala │ └── PrettifierTestUtils.scala │ └── symbols │ ├── CypherTypeTest.scala │ ├── TypeRangeTest.scala │ └── TypeSpecTest.scala ├── javacc-parser ├── LICENSES.txt ├── NOTICE.txt ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── opencypher │ │ └── v9_0 │ │ └── parser │ │ └── javacc │ │ ├── AliasName.java │ │ ├── CypherCharStream.java │ │ ├── EntityType.java │ │ ├── ExpectBar.java │ │ ├── ExpressionTokens.java │ │ ├── IdentifierTokens.java │ │ ├── InvalidUnicodeLiteral.java │ │ ├── ParseExceptions.java │ │ ├── WithOffset.java │ │ └── cypher.jj │ └── test │ └── java │ └── org │ └── opencypher │ └── v9_0 │ └── parser │ └── javacc │ ├── CypherCharStreamTest.java │ └── ParseExceptionsTest.java ├── neo4j-ast-factory ├── LICENSES.txt ├── NOTICE.txt ├── pom.xml └── src │ ├── main │ └── scala │ │ └── org │ │ └── opencypher │ │ └── v9_0 │ │ └── ast │ │ └── factory │ │ └── neo4j │ │ ├── JavaCCParser.scala │ │ ├── JavaccRule.scala │ │ ├── Neo4jASTConstructionException.scala │ │ ├── Neo4jASTExceptionFactory.scala │ │ └── Neo4jASTFactory.scala │ └── test │ └── scala │ └── org │ └── opencypher │ └── v9_0 │ └── ast │ └── factory │ └── neo4j │ ├── AdministrationAndSchemaCommandParserTestBase.scala │ ├── AliasAdministrationCommandParserTest.scala │ ├── CaseExpressionParserTest.scala │ ├── CombinedTransactionsCommandParserTest.scala │ ├── ComparisonParserTest.scala │ ├── CompositeDatabaseParserTest.scala │ ├── ConstraintCommandsParserTest.scala │ ├── CountExpressionParserTest.scala │ ├── CypherTransactionsParserTest.scala │ ├── EscapedSymbolicNameParserTest.scala │ ├── ExpressionParserTest.scala │ ├── FloatLiteralParserTest.scala │ ├── FunctionInvocationParserTest.scala │ ├── HintsParserTest.scala │ ├── IndexCommandsParserTest.scala │ ├── JavaccParserAstTestBase.scala │ ├── JavaccParserTestBase.scala │ ├── LabelExpressionsParserTest.scala │ ├── ListComprehensionParserTest.scala │ ├── LiteralsParserTest.scala │ ├── MapProjectionParserTest.scala │ ├── MiscParserTest.scala │ ├── MultiDatabaseAdministrationCommandParserTest.scala │ ├── MultipleGraphClausesParsingTest.scala │ ├── Neo4jASTFactoryTest.scala │ ├── NodePatternPredicateParserTest.scala │ ├── ParserPositionTest.scala │ ├── PeriodicCommitParserTest.scala │ ├── ProcedureCallParserTest.scala │ ├── ProjectionClauseParserTest.scala │ ├── QuantifiedPathPatternParserTest.scala │ ├── RelationshipPatternPredicateParserTest.scala │ ├── RoleAdministrationCommandParserTest.scala │ ├── ServerManagementCommandParserTest.scala │ ├── ShowFunctionsCommandParserTest.scala │ ├── ShowProceduresCommandParserTest.scala │ ├── ShowSchemaCommandParserTest.scala │ ├── ShowTransactionsCommandParserTest.scala │ ├── StatementReturnColumnsParserTest.scala │ ├── SubqueryCallParserTest.scala │ ├── TerminateTransactionsCommandParserTest.scala │ ├── UseParserTest.scala │ ├── UserAdministrationCommandParserTest.scala │ ├── VerifyAstPositionTestSupport.scala │ └── privilege │ ├── AllGraphPrivilegeAdministrationCommandParserTest.scala │ ├── CreateDeletePrivilegeAdministrationCommandParserTest.scala │ ├── DatabasePrivilegeAdministrationCommandParserTest.scala │ ├── DbmsPrivilegeAdministrationCommandParserTest.scala │ ├── DbmsPrivilegeDenyTests.scala │ ├── DbmsPrivilegeGrantTests.scala │ ├── DbmsPrivilegeRevokeDenyTests.scala │ ├── DbmsPrivilegeRevokeGrantTests.scala │ ├── DbmsPrivilegeRevokeTests.scala │ ├── ExecuteFunctionPrivilegeAdministrationCommandParserTest.scala │ ├── ExecuteProcedurePrivilegeAdministrationCommandParserTest.scala │ ├── ImpersonatePrivilegeParserTest.scala │ ├── LabelPrivilegeAdministrationCommandParserTest.scala │ ├── MergePrivilegeAdministrationCommandParserTest.scala │ ├── PropertyPrivilegeAdministrationCommandParserTest.scala │ ├── ReadMatchPrivilegeAdministrationCommandParserTest.scala │ ├── ShowPrivilegesAdministrationCommandParserTest.scala │ ├── TraversePrivilegeAdministrationCommandParserTest.scala │ └── WritePrivilegeAdministrationCommandParserTest.scala ├── pom.xml ├── rewriting ├── LICENSE.txt ├── LICENSES.txt ├── NOTICE.txt ├── pom.xml └── src │ ├── main │ └── scala │ │ └── org │ │ └── opencypher │ │ └── v9_0 │ │ └── rewriting │ │ ├── AstRewritingMonitor.scala │ │ ├── Deprecation.scala │ │ ├── RewriterStep.scala │ │ ├── RewriterTask.scala │ │ ├── RewriterTaskProcessor.scala │ │ ├── conditions │ │ ├── aggregationsAreIsolated.scala │ │ ├── collectNodesOfType.scala │ │ ├── containsNamedPathOnlyForShortestPath.scala │ │ ├── containsNoMatchingNodes.scala │ │ ├── containsNoNodesOfType.scala │ │ ├── containsNoReturnAll.scala │ │ ├── noDuplicatesInReturnItems.scala │ │ ├── noReferenceEqualityAmongVariables.scala │ │ ├── noUnnamedPatternElementsInMatch.scala │ │ ├── noUnnamedPatternElementsInPatternComprehension.scala │ │ ├── normalizedEqualsArguments.scala │ │ └── package.scala │ │ └── rewriters │ │ ├── AddUniquenessPredicates.scala │ │ ├── InliningContext.scala │ │ ├── LabelExpressionNormalizer.scala │ │ ├── LabelExpressionPredicateNormalizer.scala │ │ ├── LabelExpressionsInPatternsNormalizer.scala │ │ ├── MatchPredicateNormalizer.scala │ │ ├── MatchPredicateNormalizerChain.scala │ │ ├── NodePatternPredicateNormalizer.scala │ │ ├── PropertyPredicateNormalizer.scala │ │ ├── QuantifiedPathPatternNodeInsertRewriter.scala │ │ ├── RelationshipPatternPredicateNormalizer.scala │ │ ├── anonymizeQuery.scala │ │ ├── copyVariables.scala │ │ ├── desugarMapProjection.scala │ │ ├── expandCallWhere.scala │ │ ├── expandShowWhere.scala │ │ ├── expandStar.scala │ │ ├── factories │ │ ├── ASTRewriterFactory.scala │ │ ├── PreparatoryRewritingRewriterFactory.scala │ │ └── combineSetProperty.scala │ │ ├── foldConstants.scala │ │ ├── inlineNamedPathsInPatternComprehensions.scala │ │ ├── inliningContextCreator.scala │ │ ├── insertWithBetweenOptionalMatchAndMatch.scala │ │ ├── literalReplacement.scala │ │ ├── mergeInPredicates.scala │ │ ├── moveWithPastMatch.scala │ │ ├── nameAllPatternElements.scala │ │ ├── normalizeArgumentOrder.scala │ │ ├── normalizeComparisons.scala │ │ ├── normalizeExistsPatternExpressions.scala │ │ ├── normalizeHasLabelsAndHasType.scala │ │ ├── normalizeMatchPredicates.scala │ │ ├── normalizeNotEquals.scala │ │ ├── normalizePatternComprehensionPredicates.scala │ │ ├── normalizeWithAndReturnClauses.scala │ │ ├── parameterValueTypeReplacement.scala │ │ ├── projectNamedPaths.scala │ │ ├── reattachedALiasedExpressions.scala │ │ ├── recordScopes.scala │ │ ├── repeatWithSizeLimit.scala │ │ ├── replaceLiteralDynamicPropertyLookups.scala │ │ ├── rewriteOrderById.scala │ │ ├── rewriteShortestPathWithFixedLengthRel.scala │ │ ├── rewriteShowQuery.scala │ │ ├── sensitiveLiteralReplacement.scala │ │ ├── simplifyIterablePredicates.scala │ │ ├── timestampRewriter.scala │ │ └── unwrapParenthesizedPath.scala │ └── test │ └── scala │ └── org │ └── opencypher │ └── v9_0 │ └── rewriting │ ├── AddUniquenessPredicatesTest.scala │ ├── AnonymizeQueryTest.scala │ ├── AnonymizerTestBase.scala │ ├── AstRewritingTestSupport.scala │ ├── CombineSetPropertyTest.scala │ ├── DesugarDesugaredMapProjectionTest.scala │ ├── ExpandCallWhereTest.scala │ ├── ExpandShowWhereTest.scala │ ├── ExpandStarTest.scala │ ├── FoldConstantsTest.scala │ ├── InliningContextCreatorTest.scala │ ├── InliningContextTest.scala │ ├── InsertWithBetweenOptionalMatchAndMatchTest.scala │ ├── LiteralReplacementTest.scala │ ├── NormalizeArgumentOrderTest.scala │ ├── NormalizeComparisonsTest.scala │ ├── NormalizeNotEqualsTest.scala │ ├── NormalizeWithAndReturnClausesTest.scala │ ├── ParameterTypeValueReplacementTest.scala │ ├── PredicateTestSupport.scala │ ├── ProjectNamedPathsTest.scala │ ├── ReattachAliasedExpressionsTest.scala │ ├── ReplaceLiteralDynamicPropertyLookupsTest.scala │ ├── RewriteTest.scala │ ├── SensitiveLiteralReplacementTest.scala │ ├── ShortestPathFixedLengthReplacementTest.scala │ ├── conditions │ ├── AggregationsAreIsolatedTest.scala │ ├── CollectNodesOfTypeTest.scala │ ├── ContainsNamedPathOnlyForShortestPathTest.scala │ ├── ContainsNoMatchingNodesTest.scala │ ├── ContainsNoNodesOfTypeTest.scala │ ├── NoDuplicatesInReturnItemsTest.scala │ ├── NoReferenceEqualityAmongVariablesTest.scala │ ├── NoUnnamedPatternElementsInMatchTest.scala │ ├── NormalizedEqualsArgumentsTest.scala │ └── noUnnamedPatternElementsInPatternComprehensionTest.scala │ ├── inlineNamedPathsInPatternComprehensionsTest.scala │ ├── nameAllPatternElementsTest.scala │ ├── normalizeMatchPredicatesTest.scala │ ├── normalizePatternComprehensionPredicatesTest.scala │ ├── rewriters │ ├── QuantifiedPathPatternNodeInsertRewriterTest.scala │ ├── moveWithPastMatchTest.scala │ ├── rewriteOrderByIdTest.scala │ ├── simplifyIterablePredicatesTest.scala │ └── timestampRewriterTest.scala │ └── unwrapParenthesizedPathTest.scala ├── test-util ├── LICENSE.txt ├── LICENSES.txt ├── NOTICE.txt ├── pom.xml └── src │ └── main │ ├── java │ └── org │ │ └── opencypher │ │ └── v9_0 │ │ └── test │ │ └── util │ │ └── DumpUtils.java │ └── scala │ └── org │ └── opencypher │ └── v9_0 │ └── util │ └── test_helpers │ ├── CypherFunSuite.scala │ ├── CypherTestSupport.scala │ ├── DenylistEntry.scala │ ├── Extractors.scala │ ├── FeatureQueryTest.scala │ ├── FeatureTest.scala │ ├── IgnoreAllTests.scala │ ├── TimeLimitedCypherTest.scala │ └── WindowsStringSafe.scala └── util ├── LICENSE.txt ├── LICENSES.txt ├── NOTICE.txt ├── pom.xml └── src ├── main ├── java │ └── org │ │ └── opencypher │ │ └── v9_0 │ │ └── util │ │ └── AssertionRunner.java └── scala │ └── org │ └── opencypher │ └── v9_0 │ └── util │ ├── ASTNode.scala │ ├── AnonymousVariableNameGenerator.scala │ ├── CancellationChecker.scala │ ├── Cardinality.scala │ ├── CartesianOrdering.scala │ ├── CypherException.scala │ ├── CypherExceptionFactory.scala │ ├── DummyPosition.scala │ ├── Eagerly.scala │ ├── ErrorMessageProvider.scala │ ├── Foldable.scala │ ├── IdentityMap.scala │ ├── InputPosition.scala │ ├── InternalNotification.scala │ ├── InternalNotificationLogger.scala │ ├── NameId.scala │ ├── NonEmptyList.scala │ ├── ObfuscationMetadata.scala │ ├── OpenCypherExceptionFactory.scala │ ├── PredicateOrdering.scala │ ├── Ref.scala │ ├── Repetition.scala │ ├── Rewritable.scala │ ├── Selectivity.scala │ ├── SizeBucket.scala │ ├── StepSequencer.scala │ ├── TaskCloser.scala │ ├── Unchangeable.scala │ ├── ZeroOneOrMany.scala │ ├── attribution │ ├── Attribute.scala │ └── Ids.scala │ ├── helpers │ ├── LineBreakRemover.scala │ ├── NameDeduplicator.scala │ ├── PartialFunctionSupport.scala │ ├── StringHelper.scala │ ├── TreeZipper.scala │ └── fixedPoint.scala │ ├── package.scala │ └── symbols │ ├── AnyType.scala │ ├── BooleanType.scala │ ├── CypherType.scala │ ├── FloatType.scala │ ├── GeometryType.scala │ ├── GraphRefType.scala │ ├── IntegerType.scala │ ├── ListType.scala │ ├── MapType.scala │ ├── NodeType.scala │ ├── NumberType.scala │ ├── PathType.scala │ ├── PointType.scala │ ├── RelationshipType.scala │ ├── StorableType.scala │ ├── StringType.scala │ ├── TemporalTypes.scala │ ├── TypeRange.scala │ ├── TypeSpec.scala │ └── package.scala └── test └── scala └── org └── opencypher └── v9_0 └── util ├── EagerlyTest.scala ├── IdentityMapTest.scala ├── PredicateOrderingTest.scala ├── RewritableTest.scala ├── SizeBucketTest.scala ├── StepSequencerTest.scala ├── TaskCloserTest.scala ├── ZeroOneOrManyTest.scala ├── attribution └── AttributeTest.scala └── helpers ├── LineBreakRemoverTest.scala ├── NameDeduplicatorTest.scala └── TreeZipperTest.scala /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | \#* 3 | target 4 | out 5 | .floo* 6 | .project 7 | .classpath 8 | .settings 9 | .externalToolBuilders/ 10 | .scala_dependencies 11 | .factorypath 12 | .cache 13 | .cache-main 14 | .cache-tests 15 | *.iws 16 | *.ipr 17 | *.iml 18 | .idea 19 | .vscode 20 | .DS_Store 21 | .shell_history 22 | .mailmap 23 | .java-version 24 | .cache-main 25 | .cache-tests 26 | Thumbs.db 27 | .cache-main 28 | .cache-tests 29 | /.profiler/ 30 | dependency-reduced-pom.xml -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | language: java 3 | jdk: 4 | - oraclejdk8 5 | # we want the latest release of JDK8 6 | addons: 7 | apt: 8 | packages: 9 | - oracle-java8-installer 10 | sudo: false 11 | script: mvn clean verify 12 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 16 | Third-party licenses 17 | -------------------- 18 | 19 | BSD - Scala License 20 | Scala Library 21 | 22 | -------------------------------------------------------------------------------- /ast-factory/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 16 | Third-party licenses 17 | -------------------- 18 | 19 | Apache Software License, Version 2.0 20 | Scala Compiler 21 | 22 | BSD - Scala License 23 | Scala Library 24 | 25 | -------------------------------------------------------------------------------- /ast-factory/src/main/java/org/opencypher/v9_0/ast/factory/AccessType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory; 17 | 18 | public enum AccessType { 19 | READ_ONLY, 20 | READ_WRITE 21 | } 22 | -------------------------------------------------------------------------------- /ast-factory/src/main/java/org/opencypher/v9_0/ast/factory/ConstraintType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory; 17 | 18 | public enum ConstraintType { 19 | UNIQUE("IS UNIQUE"), 20 | NODE_KEY("IS NODE KEY"), 21 | NODE_EXISTS("EXISTS"), 22 | NODE_IS_NOT_NULL("IS NOT NULL"), 23 | REL_EXISTS("EXISTS"), 24 | REL_IS_NOT_NULL("IS NOT NULL"); 25 | 26 | private final String description; 27 | 28 | ConstraintType(String description) { 29 | this.description = description; 30 | } 31 | 32 | public String description() { 33 | return description; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ast-factory/src/main/java/org/opencypher/v9_0/ast/factory/ConstraintVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory; 17 | 18 | public enum ConstraintVersion { 19 | CONSTRAINT_VERSION_0, // ASSERT EXISTS, ASSERT ... IS UNIQUE, ASSERT ... IS NODE KEY 20 | CONSTRAINT_VERSION_1, // ASSERT ... IS NOT NULL 21 | CONSTRAINT_VERSION_2 // REQUIRE 22 | } 23 | -------------------------------------------------------------------------------- /ast-factory/src/main/java/org/opencypher/v9_0/ast/factory/CreateIndexTypes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory; 17 | 18 | public enum CreateIndexTypes { 19 | BTREE("BTREE"), 20 | RANGE("RANGE"), 21 | FULLTEXT("FULLTEXT"), 22 | LOOKUP("LOOKUP"), 23 | TEXT("TEXT"), 24 | POINT("POINT"), 25 | DEFAULT("DEFAULT"), 26 | INVALID("INVALID"); 27 | 28 | private final String description; 29 | 30 | CreateIndexTypes(String description) { 31 | this.description = description; 32 | } 33 | 34 | public String description() { 35 | return description; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ast-factory/src/main/java/org/opencypher/v9_0/ast/factory/HintIndexType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory; 17 | 18 | public enum HintIndexType { 19 | ANY, 20 | BTREE, 21 | TEXT, 22 | RANGE, 23 | POINT 24 | } 25 | -------------------------------------------------------------------------------- /ast-factory/src/main/java/org/opencypher/v9_0/ast/factory/ParameterType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory; 17 | 18 | public enum ParameterType { 19 | ANY, 20 | STRING, 21 | MAP 22 | } 23 | -------------------------------------------------------------------------------- /ast-factory/src/main/java/org/opencypher/v9_0/ast/factory/ScopeType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory; 17 | 18 | public enum ScopeType { 19 | ALL, 20 | DEFAULT, 21 | HOME, 22 | NAMED 23 | } 24 | -------------------------------------------------------------------------------- /ast/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 16 | Third-party licenses 17 | -------------------- 18 | 19 | Apache Software License, Version 2.0 20 | Apache Commons Lang 21 | openCypher Expressions 22 | openCypher Utils 23 | 24 | BSD - Scala License 25 | Scala Library 26 | 27 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/ConstraintVersion.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | sealed trait ConstraintVersion 19 | 20 | case object ConstraintVersion0 extends ConstraintVersion // ASSERT EXISTS, ASSERT ... IS UNIQUE, ASSERT ... IS NODE KEY 21 | 22 | case object ConstraintVersion1 extends ConstraintVersion // ASSERT ... IS NOT NULL 23 | 24 | case object ConstraintVersion2 extends ConstraintVersion // REQUIRE 25 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/IfExistsDo.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | sealed trait IfExistsDo 19 | 20 | case object IfExistsReplace extends IfExistsDo 21 | 22 | case object IfExistsDoNothing extends IfExistsDo 23 | 24 | case object IfExistsThrowError extends IfExistsDo 25 | 26 | case object IfExistsInvalidSyntax extends IfExistsDo 27 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/Limit.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | import org.opencypher.v9_0.expressions.Expression 19 | import org.opencypher.v9_0.util.ASTNode 20 | import org.opencypher.v9_0.util.InputPosition 21 | 22 | case class Limit(expression: Expression)(val position: InputPosition) extends ASTNode with ASTSlicingPhrase { 23 | override def name = "LIMIT" // ASTSlicingPhrase name 24 | } 25 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/MergeAction.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | import org.opencypher.v9_0.ast.semantics.SemanticCheck 19 | import org.opencypher.v9_0.ast.semantics.SemanticCheckable 20 | import org.opencypher.v9_0.util.ASTNode 21 | import org.opencypher.v9_0.util.InputPosition 22 | 23 | sealed trait MergeAction extends ASTNode with SemanticCheckable 24 | 25 | case class OnCreate(action: SetClause)(val position: InputPosition) extends MergeAction { 26 | def semanticCheck: SemanticCheck = action.semanticCheck 27 | } 28 | 29 | case class OnMatch(action: SetClause)(val position: InputPosition) extends MergeAction { 30 | def semanticCheck: SemanticCheck = action.semanticCheck 31 | } 32 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/Options.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | import org.opencypher.v9_0.expressions.Expression 19 | import org.opencypher.v9_0.expressions.Parameter 20 | 21 | sealed trait Options 22 | case object NoOptions extends Options 23 | case class OptionsParam(parameter: Parameter) extends Options 24 | case class OptionsMap(map: Map[String, Expression]) extends Options 25 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/PrivilegeType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | import org.opencypher.v9_0.util.InputPosition 19 | 20 | abstract class PrivilegeType(val name: String) 21 | 22 | final case class GraphPrivilege(action: GraphAction, scope: List[GraphScope])(val position: InputPosition) 23 | extends PrivilegeType(action.name) 24 | 25 | final case class DatabasePrivilege(action: DatabaseAction, scope: List[DatabaseScope])(val position: InputPosition) 26 | extends PrivilegeType(action.name) 27 | 28 | final case class DbmsPrivilege(action: DbmsAction)(val position: InputPosition) extends PrivilegeType(action.name) 29 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/ProcedureResult.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | import org.opencypher.v9_0.ast.semantics.SemanticCheck 19 | import org.opencypher.v9_0.util.ASTNode 20 | import org.opencypher.v9_0.util.InputPosition 21 | 22 | object ProcedureResult { 23 | 24 | def from(items: ProcedureResultItem*)(position: InputPosition): ProcedureResult = 25 | ProcedureResult(items.toIndexedSeq, None)(position) 26 | } 27 | 28 | case class ProcedureResult(items: IndexedSeq[ProcedureResultItem], where: Option[Where] = None)( 29 | val position: InputPosition 30 | ) extends ASTNode { 31 | 32 | def semanticCheck: SemanticCheck = 33 | items.foldSemanticCheck(_.semanticCheck) chain where.foldSemanticCheck(_.semanticCheck) 34 | } 35 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/RevokeType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | import org.opencypher.v9_0.util.InputPosition 19 | 20 | abstract class RevokeType(val name: String, val relType: String) 21 | 22 | final case class RevokeGrantType()(val position: InputPosition) extends RevokeType("GRANT", "GRANTED") 23 | 24 | final case class RevokeDenyType()(val position: InputPosition) extends RevokeType("DENY", "DENIED") 25 | 26 | final case class RevokeBothType()(val position: InputPosition) extends RevokeType("", "") 27 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/ShowExecutableBy.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | sealed trait ExecutableBy { 19 | def description(forType: String): String 20 | } 21 | 22 | object ExecutableBy { 23 | def defaultDescription(forType: String): String = s"${forType}ForUser(all)" 24 | } 25 | 26 | case object CurrentUser extends ExecutableBy { 27 | override def description(forType: String): String = s"${forType}ForUser(current)" 28 | } 29 | 30 | case class User(name: String) extends ExecutableBy { 31 | override def description(forType: String): String = s"${forType}ForUser($name)" 32 | } 33 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/ShowFunctionTypes.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | sealed trait ShowFunctionType { 19 | val prettyPrint: String 20 | val description: String 21 | } 22 | 23 | case object AllFunctions extends ShowFunctionType { 24 | override val prettyPrint: String = "ALL" 25 | override val description: String = "allFunctions" 26 | } 27 | 28 | case object BuiltInFunctions extends ShowFunctionType { 29 | override val prettyPrint: String = "BUILT IN" 30 | override val description: String = "builtInFunctions" 31 | } 32 | 33 | case object UserDefinedFunctions extends ShowFunctionType { 34 | override val prettyPrint: String = "USER DEFINED" 35 | override val description: String = "userDefinedFunctions" 36 | } 37 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/Skip.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | import org.opencypher.v9_0.expressions.Expression 19 | import org.opencypher.v9_0.util.ASTNode 20 | import org.opencypher.v9_0.util.InputPosition 21 | 22 | case class Skip(expression: Expression)(val position: InputPosition) extends ASTNode with ASTSlicingPhrase { 23 | override def name = "SKIP" // ASTSlicingPhrase name 24 | } 25 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/Statement.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | import org.opencypher.v9_0.ast.semantics.SemanticCheck 19 | import org.opencypher.v9_0.expressions.LogicalVariable 20 | import org.opencypher.v9_0.util.ASTNode 21 | 22 | trait Statement extends ASTNode { 23 | def semanticCheck: SemanticCheck 24 | 25 | def returnColumns: List[LogicalVariable] 26 | 27 | /** 28 | * @return true if the statement can write to the database. 29 | */ 30 | def containsUpdates: Boolean 31 | } 32 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/StatementWithGraph.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | trait StatementWithGraph extends Statement { 19 | def withGraph(useGraph: Option[UseGraph]): StatementWithGraph 20 | } 21 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/package.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0 17 | 18 | package object ast { 19 | 20 | // For SHOW commands, the user can supply: 21 | // * YIELD xxx WHERE xxx RETURN xxx which optionally introduces two new scopes 22 | // * WHERE on it's own which is rewritten to YIELD * WHERE 23 | // * Nothing in which case we just SHOW everything 24 | // This type represents these options as they come out of the parser 25 | type YieldOrWhere = Option[Either[(ast.Yield, Option[ast.Return]), ast.Where]] 26 | } 27 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/semantics/ScopeTreeVerifier.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.semantics 17 | 18 | import org.opencypher.v9_0.util.Ref 19 | 20 | object ScopeTreeVerifier { 21 | 22 | def verify(root: Scope): Seq[String] = { 23 | val localSymbolTableIssues = root.allScopes.flatMap { 24 | scope => 25 | scope.symbolTable.collect { 26 | case (name, symbol) if name != symbol.name => 27 | s"'$name' points to symbol with different name '$symbol' in scope #${Ref(scope).toIdString}. Scope tree:${System.lineSeparator}$root" 28 | } 29 | } 30 | localSymbolTableIssues 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ast/src/main/scala/org/opencypher/v9_0/ast/semantics/SemanticChecker.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.semantics 17 | 18 | import org.opencypher.v9_0.ast.Statement 19 | 20 | object SemanticChecker { 21 | 22 | def check( 23 | statement: Statement, 24 | state: SemanticState = SemanticState.clean, 25 | context: SemanticCheckContext = SemanticCheckContext.default 26 | ): SemanticCheckResult = { 27 | val result = statement.semanticCheck.run(state, context) 28 | val scopeTreeIssues = ScopeTreeVerifier.verify(result.state.scopeTree) 29 | if (scopeTreeIssues.nonEmpty) 30 | throw new IllegalStateException(scopeTreeIssues.mkString(s"\n")) 31 | 32 | result 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ast/src/test/scala/org/opencypher/v9_0/ast/ContainsAggregateTest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | import org.opencypher.v9_0.expressions.CountStar 19 | import org.opencypher.v9_0.expressions.containsAggregate 20 | import org.opencypher.v9_0.util.test_helpers.CypherFunSuite 21 | 22 | class ContainsAggregateTest extends CypherFunSuite with AstConstructionTestSupport { 23 | 24 | test("finds nested aggregate expressions") { 25 | val expr = add(literalInt(1), CountStar() _) 26 | 27 | containsAggregate(expr) should equal(true) 28 | } 29 | 30 | test("does not match non-aggregate expressions") { 31 | val expr = add(literalInt(1), literalInt(2)) 32 | 33 | containsAggregate(expr) should equal(false) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ast/src/test/scala/org/opencypher/v9_0/ast/FunctionNameTest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast 17 | 18 | import org.opencypher.v9_0.expressions.FunctionName 19 | import org.opencypher.v9_0.util.test_helpers.CypherFunSuite 20 | 21 | class FunctionNameTest extends CypherFunSuite { 22 | 23 | test("equality should ignore case") { 24 | FunctionName("foo")(null) should equal(FunctionName("FOO")(null)) 25 | } 26 | 27 | test("equality should respect the name") { 28 | FunctionName("foo")(null) should not equal FunctionName("FOOB")(null) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ast/src/test/scala/org/opencypher/v9_0/ast/semantics/ContainsTest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.semantics 17 | 18 | import org.opencypher.v9_0.expressions 19 | import org.opencypher.v9_0.util.DummyPosition 20 | import org.opencypher.v9_0.util.symbols.CTAny 21 | import org.opencypher.v9_0.util.symbols.CTBoolean 22 | import org.opencypher.v9_0.util.symbols.CTString 23 | 24 | class ContainsTest extends InfixExpressionTestBase(expressions.Contains(_, _)(DummyPosition(0))) { 25 | 26 | test("should combine strings and possible strings") { 27 | testValidTypes(CTString, CTString)(CTBoolean) 28 | testValidTypes(CTAny, CTString)(CTBoolean) 29 | testValidTypes(CTString, CTAny)(CTBoolean) 30 | testValidTypes(CTAny, CTAny)(CTBoolean) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ast/src/test/scala/org/opencypher/v9_0/ast/semantics/EndsWithTest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.semantics 17 | 18 | import org.opencypher.v9_0.expressions 19 | import org.opencypher.v9_0.util.DummyPosition 20 | import org.opencypher.v9_0.util.symbols.CTAny 21 | import org.opencypher.v9_0.util.symbols.CTBoolean 22 | import org.opencypher.v9_0.util.symbols.CTString 23 | 24 | class EndsWithTest extends InfixExpressionTestBase(expressions.EndsWith(_, _)(DummyPosition(0))) { 25 | 26 | test("should combine strings and possible strings") { 27 | testValidTypes(CTString, CTString)(CTBoolean) 28 | testValidTypes(CTAny, CTString)(CTBoolean) 29 | testValidTypes(CTString, CTAny)(CTBoolean) 30 | testValidTypes(CTAny, CTAny)(CTBoolean) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ast/src/test/scala/org/opencypher/v9_0/ast/semantics/StartsWithTest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.semantics 17 | 18 | import org.opencypher.v9_0.expressions 19 | import org.opencypher.v9_0.util.DummyPosition 20 | import org.opencypher.v9_0.util.symbols.CTAny 21 | import org.opencypher.v9_0.util.symbols.CTBoolean 22 | import org.opencypher.v9_0.util.symbols.CTString 23 | 24 | class StartsWithTest extends InfixExpressionTestBase(expressions.StartsWith(_, _)(DummyPosition(0))) { 25 | 26 | test("should combine strings and possible strings") { 27 | testValidTypes(CTString, CTString)(CTBoolean) 28 | testValidTypes(CTAny, CTString)(CTBoolean) 29 | testValidTypes(CTString, CTAny)(CTBoolean) 30 | testValidTypes(CTAny, CTAny)(CTBoolean) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ast/src/test/scala/org/opencypher/v9_0/ast/semantics/TestExpression.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.semantics 17 | 18 | import org.opencypher.v9_0.expressions.Expression 19 | import org.opencypher.v9_0.expressions.Expression.SemanticContext 20 | import org.opencypher.v9_0.util.DummyPosition 21 | import org.opencypher.v9_0.util.InputPosition 22 | import org.opencypher.v9_0.util.symbols.TypeSpec 23 | 24 | case class ErrorExpression( 25 | error: SemanticError, 26 | possibleTypes: TypeSpec, 27 | position: InputPosition = DummyPosition(0) 28 | ) extends Expression 29 | 30 | case class CustomExpression( 31 | semanticCheck: (SemanticContext, CustomExpression) => SemanticCheck, 32 | position: InputPosition = DummyPosition(0) 33 | ) extends Expression 34 | -------------------------------------------------------------------------------- /build/configs/ASL-2-header.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /build/configs/BSD License 2-clause: -------------------------------------------------------------------------------- 1 | Copyright 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /build/configs/MIT License: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /build/configs/list-prefix.txt: -------------------------------------------------------------------------------- 1 | This file contains the full license text of the included third party 2 | libraries. For an overview of the licenses see the NOTICE.txt file. 3 | -------------------------------------------------------------------------------- /cypher-macros/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 16 | Third-party licenses 17 | -------------------- 18 | 19 | Apache Software License, Version 2.0 20 | Apache Commons Lang 21 | openCypher Utils 22 | org.apiguardian:apiguardian-api 23 | org.opentest4j:opentest4j 24 | Scala Compiler 25 | 26 | BSD - Scala License 27 | Scala Library 28 | 29 | BSD License 30 | scalacheck 31 | test-interface 32 | 33 | Eclipse Public License - v 1.0 34 | JUnit 35 | 36 | Eclipse Public License v2.0 37 | JUnit Platform Commons 38 | JUnit Platform Engine API 39 | JUnit Vintage Engine 40 | 41 | -------------------------------------------------------------------------------- /expressions/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 16 | Third-party licenses 17 | -------------------- 18 | 19 | Apache Software License, Version 2.0 20 | Apache Commons Lang 21 | openCypher Utils 22 | Scala Compiler 23 | scala-xml 24 | scalactic 25 | scalatest 26 | 27 | BSD - Scala License 28 | Scala Library 29 | 30 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/AndedPropertyInequalities.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.InputPosition 19 | import org.opencypher.v9_0.util.NonEmptyList 20 | 21 | case class AndedPropertyInequalities( 22 | variable: LogicalVariable, 23 | property: LogicalProperty, 24 | inequalities: NonEmptyList[InequalityExpression] 25 | ) extends BooleanExpression { 26 | def position: InputPosition = variable.position 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/CanonicalStringHelper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | object CanonicalStringHelper { 19 | 20 | private def relTypeCanonicalString(relType: Option[RelTypeName]): String = 21 | relType.map(rT => s"[:${rT.name}]").getOrElse("") 22 | 23 | def nodeRelationCanonicalString(node: Expression, relType: Option[RelTypeName], dir: SemanticDirection): String = 24 | s"(${node.asCanonicalStringVal})${dir.leftArrowCanonicalString}${relTypeCanonicalString(relType)}${dir.rightArrowCanonicalString}()" 25 | 26 | } 27 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/CoerceTo.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.symbols.CypherType 19 | 20 | case class CoerceTo(expr: Expression, typ: CypherType) extends Expression { 21 | def position = expr.position 22 | } 23 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/CollectAll.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.InputPosition 19 | 20 | /** 21 | * Special aggregating function for performing collect() but preserving nulls. Not exposed in Cypher. 22 | * 23 | * @param expr the expression to collect 24 | */ 25 | case class CollectAll(expr: Expression)(val position: InputPosition) extends Expression { 26 | override def asCanonicalStringVal: String = s"collect_all(${expr.asCanonicalStringVal})" 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/ConstantExpression.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | object ConstantExpression { 19 | 20 | def unapply(v: AnyRef): Option[Expression] = v match { 21 | case expr: Literal => Some(expr) 22 | case expr: Parameter => Some(expr) 23 | case expr @ ListLiteral(expressions) if expressions.forall(unapply(_).nonEmpty) => Some(expr) 24 | case _ => None 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/CountStar.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.InputPosition 19 | 20 | case class CountStar()(val position: InputPosition) extends Expression { 21 | override def asCanonicalStringVal: String = "count(*)" 22 | } 23 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/GetDegree.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.expressions.CanonicalStringHelper.nodeRelationCanonicalString 19 | import org.opencypher.v9_0.util.InputPosition 20 | 21 | case class GetDegree( 22 | node: Expression, 23 | relType: Option[RelTypeName], 24 | dir: SemanticDirection 25 | )(val position: InputPosition) extends Expression { 26 | 27 | override def asCanonicalStringVal: String = 28 | s"getDegree(${nodeRelationCanonicalString(node, relType, dir)})" 29 | 30 | } 31 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/ImplicitProcedureArgument.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.InputPosition 19 | import org.opencypher.v9_0.util.symbols.CypherType 20 | 21 | case class ImplicitProcedureArgument(name: String, parameterType: CypherType, defaultValue: AnyRef) 22 | extends Expression { 23 | 24 | override def asCanonicalStringVal: String = "$" + name 25 | 26 | override def position: InputPosition = InputPosition.NONE 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/LogicalProperty.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | abstract class LogicalProperty extends Expression { 19 | def map: Expression 20 | def propertyKey: PropertyKeyName 21 | } 22 | 23 | object LogicalProperty { 24 | def unapply(p: LogicalProperty): Option[(Expression, PropertyKeyName)] = Some((p.map, p.propertyKey)) 25 | } 26 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/LogicalVariable.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.InputPosition 19 | 20 | abstract class LogicalVariable extends Expression { 21 | def name: String 22 | 23 | def copyId: LogicalVariable 24 | 25 | def renameId(newName: String): LogicalVariable 26 | 27 | def position: InputPosition 28 | 29 | override def asCanonicalStringVal: String = name 30 | } 31 | 32 | object LogicalVariable { 33 | def unapply(arg: Variable): Option[String] = Some(arg.name) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/MapExpression.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.InputPosition 19 | 20 | case class MapExpression(items: Seq[(PropertyKeyName, Expression)])(val position: InputPosition) extends Expression { 21 | 22 | override def asCanonicalStringVal: String = items.map { 23 | case (key, value) => s"${key.asCanonicalStringVal}: ${value.asCanonicalStringVal}" 24 | }.mkString("{", ", ", "}") 25 | } 26 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/Property.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.InputPosition 19 | 20 | case class Property(map: Expression, propertyKey: PropertyKeyName)(val position: InputPosition) 21 | extends LogicalProperty { 22 | override def asCanonicalStringVal = s"${map.asCanonicalStringVal}.${propertyKey.asCanonicalStringVal}" 23 | } 24 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/Range.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.ASTNode 19 | import org.opencypher.v9_0.util.InputPosition 20 | 21 | case class Range(lower: Option[UnsignedIntegerLiteral], upper: Option[UnsignedIntegerLiteral])( 22 | val position: InputPosition 23 | ) extends ASTNode 24 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/ShortestPathExpression.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | case class ShortestPathExpression(pattern: ShortestPaths) extends Expression { 19 | def position = pattern.position 20 | } 21 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/SubqueryExpression.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | /** 19 | * Marker trait for all expressions that evaluate subqueies. 20 | */ 21 | trait SubqueryExpression extends Expression 22 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/TypeSignatures.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | trait TypeSignatures { 19 | 20 | def signatures: Seq[TypeSignature] = Seq.empty 21 | 22 | lazy val signatureLengths: Seq[Int] = signatures.map(_.argumentTypes.length) 23 | } 24 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/Variable.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.InputPosition 19 | 20 | case class Variable(name: String)(val position: InputPosition) extends LogicalVariable { 21 | 22 | override def copyId: Variable = copy()(position) 23 | 24 | override def renameId(newName: String): Variable = copy(name = newName)(position) 25 | } 26 | 27 | object Variable { 28 | 29 | implicit val byName: Ordering[Variable] = 30 | Ordering.by { variable: Variable => 31 | (variable.name, variable.position) 32 | }(Ordering.Tuple2(implicitly[Ordering[String]], InputPosition.byOffset)) 33 | } 34 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/containsAggregate.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.Foldable.SkipChildren 19 | 20 | object containsAggregate extends (Expression => Boolean) { 21 | 22 | def apply(expr: Expression): Boolean = { 23 | expr.folder.treeFold[Boolean](false) { 24 | case IsAggregate(_) => _ => SkipChildren(true) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Abs.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | import org.opencypher.v9_0.util.symbols.CTInteger 21 | 22 | case object Abs extends Function { 23 | def name = "abs" 24 | 25 | override val signatures: IndexedSeq[TypeSignature] = Vector( 26 | TypeSignature(this, CTInteger, CTInteger, "Returns the absolute value of an integer.", Category.NUMERIC), 27 | TypeSignature(this, CTFloat, CTFloat, "Returns the absolute value of a floating point number.", Category.NUMERIC) 28 | ) 29 | } 30 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Acos.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Acos extends Function { 22 | def name = "acos" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns the arccosine of a number in radians.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Asin.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Asin extends Function { 22 | def name = "asin" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns the arcsine of a number in radians.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Atan.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Atan extends Function { 22 | def name = "atan" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns the arctangent of a number in radians.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Atan2.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.FunctionTypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Atan2 extends Function { 22 | def name = "atan2" 23 | 24 | override val signatures = Vector( 25 | FunctionTypeSignature( 26 | this, 27 | names = Vector("y", "x"), 28 | argumentTypes = Vector(CTFloat, CTFloat), 29 | outputType = CTFloat, 30 | description = "Returns the arctangent2 of a set of coordinates in radians.", 31 | category = Category.TRIGONOMETRIC 32 | ) 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Ceil.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Ceil extends Function { 22 | def name = "ceil" 23 | 24 | override val signatures = Vector( 25 | TypeSignature( 26 | this, 27 | CTFloat, 28 | CTFloat, 29 | "Returns the smallest floating point number that is greater than or equal to a number and equal to a mathematical integer.", 30 | Category.NUMERIC 31 | ) 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Coalesce.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | 21 | case object Coalesce extends Function { 22 | def name = "coalesce" 23 | 24 | override val signatures = Vector( 25 | TypeSignature( 26 | this, 27 | CTAny, 28 | outputType = CTAny, 29 | description = "Returns the first non-null value in a list of expressions.", 30 | category = Category.SCALAR 31 | ) 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Collect.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | import org.opencypher.v9_0.util.symbols.CTList 21 | 22 | case object Collect extends AggregatingFunction { 23 | def name = "collect" 24 | 25 | override val signatures: Vector[TypeSignature] = Vector( 26 | TypeSignature( 27 | this, 28 | CTAny, 29 | CTList(CTAny), 30 | "Returns a list containing the values returned by an expression.", 31 | Category.AGGREGATING 32 | ) 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Cos.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Cos extends Function { 22 | def name = "cos" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns the cosine of a number.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Cot.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Cot extends Function { 22 | def name = "cot" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns the cotangent of a number.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Count.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | import org.opencypher.v9_0.util.symbols.CTInteger 21 | 22 | case object Count extends AggregatingFunction { 23 | def name = "count" 24 | 25 | override val signatures = Vector( 26 | TypeSignature(this, CTAny, CTInteger, "Returns the number of values or rows.", Category.AGGREGATING) 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Degrees.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Degrees extends Function { 22 | def name = "degrees" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Converts radians to degrees.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/E.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object E extends Function { 22 | def name = "e" 23 | 24 | override val signatures = Vector( 25 | TypeSignature.noArg(this, CTFloat, "Returns the base of the natural logarithm, e.", Category.LOGARITHMIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/ElementId.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTNode 20 | import org.opencypher.v9_0.util.symbols.CTRelationship 21 | import org.opencypher.v9_0.util.symbols.CTString 22 | 23 | case object ElementId extends Function { 24 | def name = "elementId" 25 | 26 | override val signatures = Vector( 27 | TypeSignature(this, CTNode, CTString, "Returns the element id of a node.", Category.SCALAR), 28 | TypeSignature(this, CTRelationship, CTString, "Returns the element id of a relationship.", Category.SCALAR) 29 | ) 30 | } 31 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/EndNode.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTNode 20 | import org.opencypher.v9_0.util.symbols.CTRelationship 21 | 22 | case object EndNode extends Function { 23 | def name = "endNode" 24 | 25 | override val signatures = Vector( 26 | TypeSignature(this, CTRelationship, CTNode, "Returns the end node of a relationship.", Category.SCALAR) 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Exists.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | import org.opencypher.v9_0.util.symbols.CTBoolean 21 | 22 | case object Exists extends Function { 23 | def name = "exists" 24 | 25 | override val signatures = Vector( 26 | TypeSignature( 27 | this, 28 | CTAny, 29 | CTBoolean, 30 | "Returns true if a match for the pattern exists in the graph.", 31 | Category.PREDICATE 32 | ) 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Exp.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Exp extends Function { 22 | def name = "exp" 23 | 24 | override val signatures = Vector( 25 | TypeSignature( 26 | this, 27 | CTFloat, 28 | CTFloat, 29 | "Returns e^n, where e is the base of the natural logarithm, and n is the value of the argument expression.", 30 | Category.LOGARITHMIC 31 | ) 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/File.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTString 20 | 21 | case object File extends Function { 22 | def name = "file" 23 | 24 | override val signatures = Vector( 25 | TypeSignature.noArg( 26 | this, 27 | CTString, 28 | "Returns the absolute path of the file that LOAD CSV is using.", 29 | Category.SCALAR 30 | ) 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Floor.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Floor extends Function { 22 | def name = "floor" 23 | 24 | override val signatures = Vector( 25 | TypeSignature( 26 | this, 27 | CTFloat, 28 | CTFloat, 29 | "Returns the largest floating point number that is less than or equal to a number and equal to a mathematical integer.", 30 | Category.NUMERIC 31 | ) 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Haversin.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Haversin extends Function { 22 | def name = "haversin" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns half the versine of a number.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Head.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.FunctionTypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | import org.opencypher.v9_0.util.symbols.CTList 21 | 22 | case object Head extends Function { 23 | val name = "head" 24 | 25 | override val signatures = Vector( 26 | FunctionTypeSignature( 27 | function = this, 28 | names = Vector("list"), 29 | argumentTypes = Vector(CTList(CTAny)), 30 | outputType = CTAny, 31 | description = "Returns the first element in a list.", 32 | category = Category.SCALAR 33 | ) 34 | ) 35 | } 36 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Id.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTInteger 20 | import org.opencypher.v9_0.util.symbols.CTNode 21 | import org.opencypher.v9_0.util.symbols.CTRelationship 22 | 23 | case object Id extends Function { 24 | def name = "id" 25 | 26 | override val signatures = Vector( 27 | TypeSignature(this, CTNode, CTInteger, "Returns the id of a node.", Category.SCALAR), 28 | TypeSignature(this, CTRelationship, CTInteger, "Returns the id of a relationship.", Category.SCALAR) 29 | ) 30 | } 31 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/IsNaN.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTBoolean 20 | import org.opencypher.v9_0.util.symbols.CTFloat 21 | import org.opencypher.v9_0.util.symbols.CTInteger 22 | 23 | case object IsNaN extends Function { 24 | def name = "isNaN" 25 | 26 | override val signatures: IndexedSeq[TypeSignature] = Vector( 27 | TypeSignature(this, CTInteger, CTBoolean, "Returns whether the given integer is NaN.", Category.NUMERIC), 28 | TypeSignature(this, CTFloat, CTBoolean, "Returns whether the given floating point number is NaN.", Category.NUMERIC) 29 | ) 30 | } 31 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/LTrim.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTString 20 | 21 | case object LTrim extends Function { 22 | def name = "ltrim" 23 | 24 | override val signatures = Vector( 25 | TypeSignature( 26 | this, 27 | CTString, 28 | CTString, 29 | "Returns the original string with leading whitespace removed.", 30 | Category.STRING 31 | ) 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Labels.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTList 20 | import org.opencypher.v9_0.util.symbols.CTNode 21 | import org.opencypher.v9_0.util.symbols.CTString 22 | 23 | case object Labels extends Function { 24 | override def name = "labels" 25 | 26 | override val signatures = Vector( 27 | TypeSignature( 28 | this, 29 | CTNode, 30 | CTList(CTString), 31 | "Returns a list containing the string representations for all the labels of a node.", 32 | Category.LIST 33 | ) 34 | ) 35 | } 36 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Last.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.FunctionTypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | import org.opencypher.v9_0.util.symbols.CTList 21 | 22 | case object Last extends Function { 23 | def name = "last" 24 | 25 | override val signatures = Vector( 26 | FunctionTypeSignature( 27 | function = this, 28 | names = Vector("list"), 29 | argumentTypes = Vector(CTList(CTAny)), 30 | outputType = CTAny, 31 | description = "Returns the last element in a list.", 32 | category = Category.SCALAR 33 | ) 34 | ) 35 | } 36 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Length.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTInteger 20 | import org.opencypher.v9_0.util.symbols.CTPath 21 | 22 | case object Length extends Function { 23 | def name = "length" 24 | 25 | override val signatures = Vector( 26 | TypeSignature(this, CTPath, CTInteger, "Returns the length of a path.", Category.SCALAR) 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Linenumber.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTInteger 20 | 21 | case object Linenumber extends Function { 22 | def name = "linenumber" 23 | 24 | override val signatures = Vector( 25 | TypeSignature.noArg(this, CTInteger, "Returns the line number that LOAD CSV is currently using.", Category.SCALAR) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Log.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Log extends Function { 22 | def name = "log" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns the natural logarithm of a number.", Category.LOGARITHMIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Log10.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Log10 extends Function { 22 | def name = "log10" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns the common logarithm (base 10) of a number.", Category.LOGARITHMIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Max.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | 21 | case object Max extends AggregatingFunction { 22 | override def name = "max" 23 | 24 | override val signatures: Vector[TypeSignature] = Vector( 25 | TypeSignature(this, CTAny, CTAny, "Returns the maximum value in a set of values.", Category.AGGREGATING) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Min.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | 21 | case object Min extends AggregatingFunction { 22 | override def name = "min" 23 | 24 | override val signatures: Vector[TypeSignature] = Vector( 25 | TypeSignature(this, CTAny, CTAny, "Returns the minimum value in a set of values.", Category.AGGREGATING) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Nodes.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTList 20 | import org.opencypher.v9_0.util.symbols.CTNode 21 | import org.opencypher.v9_0.util.symbols.CTPath 22 | 23 | case object Nodes extends Function { 24 | def name = "nodes" 25 | 26 | override val signatures = Vector( 27 | TypeSignature(this, CTPath, CTList(CTNode), "Returns a list containing all the nodes in a path.", Category.LIST) 28 | ) 29 | } 30 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/PercentileCont.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.FunctionTypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object PercentileCont extends AggregatingFunction { 22 | def name = "percentileCont" 23 | 24 | override val signatures = Vector( 25 | FunctionTypeSignature( 26 | function = this, 27 | names = Vector("input", "percentile"), 28 | argumentTypes = Vector(CTFloat, CTFloat), 29 | outputType = CTFloat, 30 | description = "Returns the percentile of a value over a group using linear interpolation.", 31 | category = Category.AGGREGATING 32 | ) 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Pi.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Pi extends Function { 22 | def name = "pi" 23 | 24 | override val signatures = Vector( 25 | TypeSignature.noArg(this, CTFloat, "Returns the mathematical constant pi.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Point.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTMap 20 | import org.opencypher.v9_0.util.symbols.CTPoint 21 | 22 | case object Point extends Function { 23 | override def name = "point" 24 | 25 | override val signatures = Vector( 26 | TypeSignature( 27 | this, 28 | CTMap, 29 | CTPoint, 30 | "Returns a 2D or 3D point object, given two or respectively three coordinate values in the Cartesian coordinate system or WGS 84 geographic coordinate system.", 31 | Category.SPATIAL 32 | ) 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/RTrim.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTString 20 | 21 | case object RTrim extends Function { 22 | def name = "rtrim" 23 | 24 | override val signatures = Vector( 25 | TypeSignature( 26 | this, 27 | CTString, 28 | CTString, 29 | "Returns the original string with trailing whitespace removed.", 30 | Category.STRING 31 | ) 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Radians.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Radians extends Function { 22 | def name = "radians" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Converts degrees to radians.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Rand.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Rand extends Function { 22 | val name = "rand" 23 | 24 | override val signatures = Vector( 25 | TypeSignature.noArg( 26 | this, 27 | CTFloat, 28 | "Returns a random floating point number in the range from 0 (inclusive) to 1 (exclusive); i.e. [0,1).", 29 | Category.NUMERIC 30 | ) 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/RandomUUID.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTString 20 | 21 | object RandomUUID extends Function { 22 | override def name: String = "randomUUID" 23 | 24 | override val signatures = Vector( 25 | TypeSignature.noArg(this, CTString, "Generates a random UUID.", Category.SCALAR) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Relationships.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTList 20 | import org.opencypher.v9_0.util.symbols.CTPath 21 | import org.opencypher.v9_0.util.symbols.CTRelationship 22 | 23 | case object Relationships extends Function { 24 | def name = "relationships" 25 | 26 | override val signatures = Vector( 27 | TypeSignature( 28 | this, 29 | CTPath, 30 | CTList(CTRelationship), 31 | "Returns a list containing all the relationships in a path.", 32 | Category.LIST 33 | ) 34 | ) 35 | } 36 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Sin.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Sin extends Function { 22 | def name = "sin" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns the sine of a number.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Size.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | import org.opencypher.v9_0.util.symbols.CTInteger 21 | import org.opencypher.v9_0.util.symbols.CTList 22 | import org.opencypher.v9_0.util.symbols.CTString 23 | 24 | case object Size extends Function { 25 | def name = "size" 26 | 27 | override val signatures = Vector( 28 | TypeSignature(this, CTList(CTAny), CTInteger, "Returns the number of items in a list.", Category.SCALAR), 29 | TypeSignature(this, CTString, CTInteger, "Returns the number of Unicode characters in a string.", Category.SCALAR) 30 | ) 31 | } 32 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Sqrt.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Sqrt extends Function { 22 | def name = "sqrt" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns the square root of a number.", Category.LOGARITHMIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/StartNode.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTNode 20 | import org.opencypher.v9_0.util.symbols.CTRelationship 21 | 22 | case object StartNode extends Function { 23 | def name = "startNode" 24 | 25 | override val signatures = Vector( 26 | TypeSignature(this, CTRelationship, CTNode, "Returns the start node of a relationship.", Category.SCALAR) 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/StdDev.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object StdDev extends AggregatingFunction { 22 | def name = "stdev" 23 | 24 | override val signatures = Vector( 25 | TypeSignature( 26 | this, 27 | CTFloat, 28 | CTFloat, 29 | "Returns the standard deviation for the given value over a group for a sample of a population.", 30 | Category.AGGREGATING 31 | ) 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/StdDevP.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object StdDevP extends AggregatingFunction { 22 | def name = "stdevp" 23 | 24 | override val signatures = Vector( 25 | TypeSignature( 26 | this, 27 | CTFloat, 28 | CTFloat, 29 | "Returns the standard deviation for the given value over a group for an entire population.", 30 | Category.AGGREGATING 31 | ) 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Tail.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | import org.opencypher.v9_0.util.symbols.CTList 21 | 22 | case object Tail extends Function { 23 | def name = "tail" 24 | 25 | override val signatures = Vector( 26 | TypeSignature( 27 | this, 28 | CTList(CTAny), 29 | CTList(CTAny), 30 | description = "Returns all but the first element in a list.", 31 | category = Category.LIST 32 | ) 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Tan.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | 21 | case object Tan extends Function { 22 | def name = "tan" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTFloat, CTFloat, "Returns the tangent of a number.", Category.TRIGONOMETRIC) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/ToBooleanOrNull.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | import org.opencypher.v9_0.util.symbols.CTBoolean 21 | 22 | case object ToBooleanOrNull extends Function { 23 | override def name = "toBooleanOrNull" 24 | 25 | override val signatures = Vector( 26 | TypeSignature( 27 | this, 28 | CTAny, 29 | CTBoolean, 30 | "Converts a value to a boolean value, or null if the value cannot be converted.", 31 | Category.SCALAR 32 | ) 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/ToFloat.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTFloat 20 | import org.opencypher.v9_0.util.symbols.CTNumber 21 | import org.opencypher.v9_0.util.symbols.CTString 22 | 23 | case object ToFloat extends Function { 24 | override def name = "toFloat" 25 | 26 | override val signatures = Vector( 27 | TypeSignature(this, CTString, CTFloat, "Converts a string value to a floating point value.", Category.SCALAR), 28 | TypeSignature(this, CTNumber, CTFloat, "Converts an integer value to a floating point value.", Category.SCALAR) 29 | ) 30 | } 31 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/ToFloatOrNull.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | import org.opencypher.v9_0.util.symbols.CTFloat 21 | 22 | case object ToFloatOrNull extends Function { 23 | override def name = "toFloatOrNull" 24 | 25 | override val signatures = Vector( 26 | TypeSignature( 27 | this, 28 | CTAny, 29 | CTFloat, 30 | "Converts a value to a floating point value, or null if the value cannot be converted.", 31 | Category.SCALAR 32 | ) 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/ToIntegerOrNull.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTAny 20 | import org.opencypher.v9_0.util.symbols.CTInteger 21 | 22 | case object ToIntegerOrNull extends Function { 23 | override def name = "toIntegerOrNull" 24 | 25 | override val signatures = Vector( 26 | TypeSignature( 27 | this, 28 | CTAny, 29 | CTInteger, 30 | "Converts a value to an integer value, or null if the value cannot be converted.", 31 | Category.SCALAR 32 | ) 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/ToLower.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTString 20 | 21 | case object ToLower extends Function { 22 | def name = "toLower" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTString, CTString, "Returns the original string in lowercase.", Category.STRING) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/ToUpper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTString 20 | 21 | case object ToUpper extends Function { 22 | def name = "toUpper" 23 | 24 | override val signatures = Vector( 25 | TypeSignature(this, CTString, CTString, "Returns the original string in uppercase.", Category.STRING) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Trim.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTString 20 | 21 | case object Trim extends Function { 22 | def name = "trim" 23 | 24 | override val signatures = Vector( 25 | TypeSignature( 26 | this, 27 | CTString, 28 | CTString, 29 | "Returns the original string with leading and trailing whitespace removed.", 30 | Category.STRING 31 | ) 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/Type.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.TypeSignature 19 | import org.opencypher.v9_0.util.symbols.CTRelationship 20 | import org.opencypher.v9_0.util.symbols.CTString 21 | 22 | case object Type extends Function { 23 | override def name = "type" 24 | 25 | override val signatures = Vector( 26 | TypeSignature( 27 | this, 28 | CTRelationship, 29 | CTString, 30 | "Returns the string representation of the relationship type.", 31 | Category.SCALAR 32 | ) 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/UnresolvedFunction.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | case object UnresolvedFunction extends Function { 19 | def name = "UNKNOWN" 20 | } 21 | -------------------------------------------------------------------------------- /expressions/src/main/scala/org/opencypher/v9_0/expressions/functions/UserDefinedFunctionInvocation.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions.functions 17 | 18 | import org.opencypher.v9_0.expressions.FunctionInvocation 19 | 20 | trait UserDefinedFunctionInvocation { 21 | def isAggregate: Boolean 22 | 23 | def asUnresolvedFunction: FunctionInvocation 24 | } 25 | -------------------------------------------------------------------------------- /expressions/src/test/scala/org/opencypher/v9_0/expressions/DummyExpression.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.expressions 17 | 18 | import org.opencypher.v9_0.util.DummyPosition 19 | import org.opencypher.v9_0.util.InputPosition 20 | import org.opencypher.v9_0.util.symbols.TypeSpec 21 | 22 | /** 23 | * This expression can be used in test code to test type specifications and expectation. 24 | */ 25 | case class DummyExpression(possibleTypes: TypeSpec, position: InputPosition = DummyPosition(0)) extends Expression 26 | -------------------------------------------------------------------------------- /frontend/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 16 | Third-party licenses 17 | -------------------- 18 | 19 | Apache Software License, Version 2.0 20 | Apache Commons Lang 21 | openCypher AST for the Cypher Query Language 22 | openCypher Expressions 23 | openCypher Macros 24 | openCypher Rewriting 25 | openCypher Utils 26 | org.apiguardian:apiguardian-api 27 | org.opentest4j:opentest4j 28 | parboiled-core 29 | parboiled-scala 30 | Scala Compiler 31 | 32 | BSD - Scala License 33 | Scala Library 34 | 35 | Eclipse Public License - v 1.0 36 | JUnit 37 | 38 | Eclipse Public License v2.0 39 | JUnit Platform Commons 40 | JUnit Platform Engine API 41 | JUnit Vintage Engine 42 | 43 | -------------------------------------------------------------------------------- /frontend/src/main/scala/org/opencypher/v9_0/frontend/PlannerName.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.frontend 17 | 18 | /** 19 | * This class defines the query planners used by cyphers. 20 | **/ 21 | trait PlannerName { 22 | def name: String 23 | def toTextOutput: String 24 | def version: String 25 | } 26 | -------------------------------------------------------------------------------- /frontend/src/main/scala/org/opencypher/v9_0/frontend/phases/Monitors.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.frontend.phases 17 | 18 | import scala.reflect.ClassTag 19 | 20 | trait Monitors { 21 | def addMonitorListener[T](monitor: T, tags: String*): Unit 22 | def newMonitor[T <: AnyRef : ClassTag](tags: String*): T 23 | } 24 | -------------------------------------------------------------------------------- /frontend/src/main/scala/org/opencypher/v9_0/frontend/phases/factories/PlanPipelineTransformerFactory.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.frontend.phases.factories 17 | 18 | import org.opencypher.v9_0.ast.semantics.SemanticFeature 19 | import org.opencypher.v9_0.frontend.phases.BaseContext 20 | import org.opencypher.v9_0.frontend.phases.BaseState 21 | import org.opencypher.v9_0.frontend.phases.Transformer 22 | 23 | trait PlanPipelineTransformerFactory { 24 | 25 | def getTransformer( 26 | pushdownPropertyReads: Boolean, 27 | semanticFeatures: Seq[SemanticFeature] 28 | ): Transformer[_ <: BaseContext, _ <: BaseState, BaseState] 29 | } 30 | -------------------------------------------------------------------------------- /javacc-parser/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 16 | Third-party licenses 17 | -------------------- 18 | 19 | Apache Software License, Version 2.0 20 | openCypher - Cypher AST factory 21 | Scala Compiler 22 | 23 | BSD - Scala License 24 | Scala Library 25 | 26 | -------------------------------------------------------------------------------- /javacc-parser/src/main/java/org/opencypher/v9_0/parser/javacc/EntityType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.parser.javacc; 17 | 18 | public enum EntityType { 19 | NODE, 20 | RELATIONSHIP, 21 | NODE_OR_RELATIONSHIP 22 | } 23 | -------------------------------------------------------------------------------- /javacc-parser/src/main/java/org/opencypher/v9_0/parser/javacc/ExpectBar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.parser.javacc; 17 | 18 | public enum ExpectBar { 19 | /** 20 | * Expect a bar to follow the label expression 21 | */ 22 | EXPECT_BAR, 23 | /** 24 | * Do not expect a bar to follow the label expression 25 | */ 26 | DO_NOT_EXPECT_BAR; 27 | } 28 | -------------------------------------------------------------------------------- /javacc-parser/src/main/java/org/opencypher/v9_0/parser/javacc/InvalidUnicodeLiteral.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.parser.javacc; 17 | 18 | public class InvalidUnicodeLiteral extends RuntimeException { 19 | public final int offset; 20 | public final int line; 21 | public final int column; 22 | 23 | public InvalidUnicodeLiteral(String message, int offset, int line, int column) { 24 | super(message); 25 | this.offset = offset; 26 | this.line = line; 27 | this.column = column; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /javacc-parser/src/main/java/org/opencypher/v9_0/parser/javacc/WithOffset.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.parser.javacc; 17 | 18 | public class WithOffset { 19 | public int beginOffset; 20 | public int endOffset; 21 | } 22 | -------------------------------------------------------------------------------- /neo4j-ast-factory/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 16 | Third-party licenses 17 | -------------------- 18 | 19 | Apache Software License, Version 2.0 20 | Apache Commons Lang 21 | openCypher - Cypher AST factory 22 | openCypher - Cypher JavaCC based parser 23 | openCypher AST for the Cypher Query Language 24 | openCypher Expressions 25 | openCypher Utils 26 | Scala Compiler 27 | scala-xml 28 | scalactic 29 | scalatest 30 | 31 | BSD - Scala License 32 | Scala Library 33 | 34 | BSD License 35 | scalacheck 36 | test-interface 37 | 38 | -------------------------------------------------------------------------------- /neo4j-ast-factory/src/main/scala/org/opencypher/v9_0/ast/factory/neo4j/Neo4jASTConstructionException.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory.neo4j 17 | 18 | class Neo4jASTConstructionException(msg: String) extends RuntimeException(msg) 19 | -------------------------------------------------------------------------------- /neo4j-ast-factory/src/test/scala/org/opencypher/v9_0/ast/factory/neo4j/privilege/DbmsPrivilegeDenyTests.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory.neo4j.privilege 17 | 18 | class DbmsPrivilegeDenyTests extends DbmsPrivilegeAdministrationCommandParserTest { 19 | privilegeTests("DENY", "TO", denyDbmsPrivilege) 20 | } 21 | -------------------------------------------------------------------------------- /neo4j-ast-factory/src/test/scala/org/opencypher/v9_0/ast/factory/neo4j/privilege/DbmsPrivilegeGrantTests.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory.neo4j.privilege 17 | 18 | class DbmsPrivilegeGrantTests extends DbmsPrivilegeAdministrationCommandParserTest { 19 | privilegeTests("GRANT", "TO", grantDbmsPrivilege) 20 | } 21 | -------------------------------------------------------------------------------- /neo4j-ast-factory/src/test/scala/org/opencypher/v9_0/ast/factory/neo4j/privilege/DbmsPrivilegeRevokeDenyTests.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory.neo4j.privilege 17 | 18 | class DbmsPrivilegeRevokeDenyTests extends DbmsPrivilegeAdministrationCommandParserTest { 19 | privilegeTests("REVOKE DENY", "FROM", revokeDenyDbmsPrivilege) 20 | } 21 | -------------------------------------------------------------------------------- /neo4j-ast-factory/src/test/scala/org/opencypher/v9_0/ast/factory/neo4j/privilege/DbmsPrivilegeRevokeGrantTests.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory.neo4j.privilege 17 | 18 | class DbmsPrivilegeRevokeGrantTests extends DbmsPrivilegeAdministrationCommandParserTest { 19 | privilegeTests("REVOKE GRANT", "FROM", revokeGrantDbmsPrivilege) 20 | } 21 | -------------------------------------------------------------------------------- /neo4j-ast-factory/src/test/scala/org/opencypher/v9_0/ast/factory/neo4j/privilege/DbmsPrivilegeRevokeTests.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.ast.factory.neo4j.privilege 17 | 18 | class DbmsPrivilegeRevokeTests extends DbmsPrivilegeAdministrationCommandParserTest { 19 | privilegeTests("REVOKE", "FROM", revokeDbmsPrivilege) 20 | } 21 | -------------------------------------------------------------------------------- /rewriting/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 16 | Third-party licenses 17 | -------------------- 18 | 19 | Apache Software License, Version 2.0 20 | Apache Commons Lang 21 | openCypher AST for the Cypher Query Language 22 | openCypher Expressions 23 | openCypher Utils 24 | 25 | BSD - Scala License 26 | Scala Library 27 | 28 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/AstRewritingMonitor.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting 17 | 18 | trait AstRewritingMonitor { 19 | def abortedRewriting(obj: AnyRef): Unit 20 | def abortedRewritingDueToLargeDNF(obj: AnyRef): Unit 21 | } 22 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/RewriterTask.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting 17 | 18 | import org.opencypher.v9_0.util.Rewriter 19 | 20 | sealed trait RewriterTask 21 | final case class RunRewriter(name: String, rewriter: Rewriter) extends RewriterTask 22 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/RewriterTaskProcessor.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting 17 | 18 | import org.opencypher.v9_0.util.Rewriter 19 | 20 | trait RewriterTaskProcessor extends (RewriterTask => Rewriter) { 21 | def sequenceName: String 22 | 23 | def apply(task: RewriterTask): Rewriter = task match { 24 | case RunRewriter(_, rewriter) => rewriter 25 | } 26 | } 27 | 28 | case class DefaultRewriterTaskProcessor(sequenceName: String) extends RewriterTaskProcessor 29 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/conditions/collectNodesOfType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.conditions 17 | 18 | import org.opencypher.v9_0.util.ASTNode 19 | import org.opencypher.v9_0.util.Foldable.FoldableAny 20 | 21 | import scala.reflect.ClassTag 22 | 23 | case class collectNodesOfType[T <: ASTNode]()(implicit tag: ClassTag[T]) extends (Any => Seq[T]) { 24 | def apply(that: Any): Seq[T] = that.folder.findAllByClass[T] 25 | } 26 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/conditions/containsNamedPathOnlyForShortestPath.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.conditions 17 | 18 | import org.opencypher.v9_0.expressions.NamedPatternPart 19 | import org.opencypher.v9_0.expressions.ShortestPaths 20 | import org.opencypher.v9_0.rewriting.ValidatingCondition 21 | 22 | case object containsNamedPathOnlyForShortestPath extends ValidatingCondition { 23 | 24 | private val matcher = containsNoMatchingNodes({ 25 | case namedPart @ NamedPatternPart(_, part) if !part.isInstanceOf[ShortestPaths] => 26 | namedPart.toString 27 | }) 28 | 29 | def apply(that: Any): Seq[String] = matcher(that) 30 | 31 | override def name: String = productPrefix 32 | } 33 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/conditions/containsNoMatchingNodes.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.conditions 17 | 18 | import org.opencypher.v9_0.util.ASTNode 19 | import org.opencypher.v9_0.util.Foldable.FoldableAny 20 | import org.opencypher.v9_0.util.InputPosition 21 | 22 | case class containsNoMatchingNodes(matcher: PartialFunction[ASTNode, String]) extends (Any => Seq[String]) { 23 | 24 | def apply(that: Any): Seq[String] = { 25 | that.folder.fold(Seq.empty[(String, InputPosition)]) { 26 | case node: ASTNode if matcher.isDefinedAt(node) => 27 | acc => acc :+ ((matcher(node), node.position)) 28 | }.map { case (name, position) => s"Expected none but found $name at position $position" } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/conditions/containsNoReturnAll.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.conditions 17 | 18 | import org.opencypher.v9_0.ast.ReturnItems 19 | import org.opencypher.v9_0.rewriting.ValidatingCondition 20 | 21 | case object containsNoReturnAll extends ValidatingCondition { 22 | 23 | private val matcher = containsNoMatchingNodes({ 24 | case ri: ReturnItems if ri.includeExisting => "ReturnItems(includeExisting = true, ...)" 25 | }) 26 | def apply(that: Any) = matcher(that) 27 | 28 | override def name: String = productPrefix 29 | } 30 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/conditions/noDuplicatesInReturnItems.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.conditions 17 | 18 | import org.opencypher.v9_0.ast.ReturnItems 19 | import org.opencypher.v9_0.rewriting.ValidatingCondition 20 | 21 | case object noDuplicatesInReturnItems extends ValidatingCondition { 22 | 23 | def apply(that: Any): Seq[String] = { 24 | val returnItems = collectNodesOfType[ReturnItems]().apply(that) 25 | returnItems.collect { 26 | case ris @ ReturnItems(_, items, _) if items.toSet.size != items.size => 27 | s"ReturnItems at ${ris.position} contain duplicate return item: $ris" 28 | } 29 | } 30 | 31 | override def name: String = productPrefix 32 | } 33 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/conditions/noReferenceEqualityAmongVariables.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.conditions 17 | 18 | import org.opencypher.v9_0.expressions.Variable 19 | import org.opencypher.v9_0.rewriting.ValidatingCondition 20 | import org.opencypher.v9_0.util.Ref 21 | 22 | case object noReferenceEqualityAmongVariables extends ValidatingCondition { 23 | 24 | def apply(that: Any): Seq[String] = { 25 | val ids = collectNodesOfType[Variable]().apply(that).map(Ref[Variable]) 26 | ids.groupBy(x => x).collect { 27 | case (id, others) if others.size > 1 => 28 | s"The instance ${id.value} is used ${others.size} times" 29 | }.toIndexedSeq 30 | } 31 | 32 | override def name: String = productPrefix 33 | } 34 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/rewriters/MatchPredicateNormalizerChain.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.rewriters 17 | 18 | import org.opencypher.v9_0.expressions.Expression 19 | import org.opencypher.v9_0.util.helpers.PartialFunctionSupport 20 | 21 | case class MatchPredicateNormalizerChain(normalizers: MatchPredicateNormalizer*) extends MatchPredicateNormalizer { 22 | 23 | val extract = 24 | PartialFunctionSupport.reduceAnyDefined(normalizers.map(_.extract))(IndexedSeq.empty[Expression])(_ ++ _) 25 | val replace = PartialFunctionSupport.composeIfDefined(normalizers.map(_.replace)) 26 | } 27 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/rewriters/NodePatternPredicateNormalizer.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.rewriters 17 | 18 | import org.opencypher.v9_0.expressions.Expression 19 | import org.opencypher.v9_0.expressions.NodePattern 20 | 21 | object NodePatternPredicateNormalizer extends MatchPredicateNormalizer { 22 | 23 | override val extract: PartialFunction[AnyRef, IndexedSeq[Expression]] = { 24 | case NodePattern(_, _, _, Some(expr)) => Vector(expr) 25 | } 26 | 27 | override val replace: PartialFunction[AnyRef, AnyRef] = { 28 | case p @ NodePattern(_, _, _, Some(_)) => p.copy(predicate = None)(p.position) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/rewriters/RelationshipPatternPredicateNormalizer.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.rewriters 17 | 18 | import org.opencypher.v9_0.expressions.Expression 19 | import org.opencypher.v9_0.expressions.RelationshipPattern 20 | 21 | object RelationshipPatternPredicateNormalizer extends MatchPredicateNormalizer { 22 | 23 | override val extract: PartialFunction[AnyRef, IndexedSeq[Expression]] = { 24 | case RelationshipPattern(_, _, _, _, Some(predicate), _) => Vector(predicate) 25 | } 26 | 27 | override val replace: PartialFunction[AnyRef, AnyRef] = { 28 | case p @ RelationshipPattern(_, _, _, _, Some(_), _) => p.copy(predicate = None)(p.position) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/rewriters/copyVariables.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.rewriters 17 | 18 | import org.opencypher.v9_0.expressions.Variable 19 | import org.opencypher.v9_0.util.Rewriter 20 | import org.opencypher.v9_0.util.bottomUp 21 | 22 | case object copyVariables extends Rewriter { 23 | private val instance = bottomUp(Rewriter.lift { case variable: Variable => variable.copyId }) 24 | 25 | def apply(that: AnyRef): AnyRef = instance.apply(that) 26 | } 27 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/rewriters/factories/ASTRewriterFactory.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.rewriters.factories 17 | 18 | import org.opencypher.v9_0.ast.semantics.SemanticState 19 | import org.opencypher.v9_0.util.AnonymousVariableNameGenerator 20 | import org.opencypher.v9_0.util.CypherExceptionFactory 21 | import org.opencypher.v9_0.util.Rewriter 22 | import org.opencypher.v9_0.util.symbols.CypherType 23 | 24 | trait ASTRewriterFactory { 25 | 26 | def getRewriter( 27 | semanticState: SemanticState, 28 | parameterTypeMapping: Map[String, CypherType], 29 | cypherExceptionFactory: CypherExceptionFactory, 30 | anonymousVariableNameGenerator: AnonymousVariableNameGenerator 31 | ): Rewriter 32 | } 33 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/rewriters/factories/PreparatoryRewritingRewriterFactory.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.rewriters.factories 17 | 18 | import org.opencypher.v9_0.util.CypherExceptionFactory 19 | import org.opencypher.v9_0.util.InternalNotificationLogger 20 | import org.opencypher.v9_0.util.Rewriter 21 | 22 | trait PreparatoryRewritingRewriterFactory { 23 | 24 | def getRewriter( 25 | cypherExceptionFactory: CypherExceptionFactory, 26 | notificationLogger: InternalNotificationLogger 27 | ): Rewriter 28 | } 29 | -------------------------------------------------------------------------------- /rewriting/src/main/scala/org/opencypher/v9_0/rewriting/rewriters/recordScopes.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting.rewriters 17 | 18 | import org.opencypher.v9_0.ast.semantics.SemanticState 19 | import org.opencypher.v9_0.expressions.ExpressionWithOuterScope 20 | import org.opencypher.v9_0.util.Rewriter 21 | import org.opencypher.v9_0.util.topDown 22 | 23 | case class recordScopes(semanticState: SemanticState) extends Rewriter { 24 | 25 | def apply(that: AnyRef): AnyRef = instance.apply(that) 26 | 27 | private val instance: Rewriter = topDown(Rewriter.lift { 28 | case x: ExpressionWithOuterScope => 29 | x.withOuterScope(semanticState.recordedScopes(x).availableSymbolDefinitions.map(_.asVariable)) 30 | }) 31 | } 32 | -------------------------------------------------------------------------------- /rewriting/src/test/scala/org/opencypher/v9_0/rewriting/AstRewritingTestSupport.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.rewriting 17 | 18 | import org.opencypher.v9_0.ast.AstConstructionTestSupport 19 | import org.opencypher.v9_0.ast.factory.neo4j.JavaCCParser 20 | import org.opencypher.v9_0.util.test_helpers.CypherTestSupport 21 | 22 | trait AstRewritingTestSupport extends CypherTestSupport with AstConstructionTestSupport { 23 | val parser: JavaCCParser.type = JavaCCParser 24 | } 25 | -------------------------------------------------------------------------------- /test-util/src/main/scala/org/opencypher/v9_0/util/test_helpers/CypherTestSupport.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.test_helpers 17 | 18 | // Inherited by test mixin classes that need to manage resources 19 | trait CypherTestSupport { 20 | protected def initTest(): Unit = {} 21 | protected def stopTest(): Unit = {} 22 | } 23 | -------------------------------------------------------------------------------- /test-util/src/main/scala/org/opencypher/v9_0/util/test_helpers/Extractors.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.test_helpers 17 | 18 | object Extractors { 19 | 20 | object SetExtractor { 21 | def unapplySeq[T](s: Set[T]): Option[Seq[T]] = Some(s.toSeq) 22 | } 23 | 24 | object MapKeys { 25 | def unapplySeq[T](s: Map[T, _]): Option[Seq[T]] = Some(s.keys.toSeq) 26 | } 27 | 28 | object MapExtractor { 29 | def unapplySeq[T, V](s: Map[T, V]): Option[Seq[(T, V)]] = Some(s.toSeq) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test-util/src/main/scala/org/opencypher/v9_0/util/test_helpers/WindowsStringSafe.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.test_helpers 17 | 18 | import org.scalactic.Equality 19 | 20 | // Makes it easy to compare strings without having to worry about new lines 21 | object WindowsStringSafe extends Equality[String] { 22 | 23 | override def areEqual(a: String, b: Any) = b match { 24 | case b: String => 25 | a.replaceAll("\r\n", "\n") equals b.replaceAll("\r\n", "\n") 26 | case _ => false 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /util/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Neo4j Sweden AB (http://neo4j.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | 16 | Third-party licenses 17 | -------------------- 18 | 19 | Apache Software License, Version 2.0 20 | Apache Commons Lang 21 | 22 | BSD - Scala License 23 | Scala Library 24 | 25 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/CancellationChecker.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util 17 | 18 | /** 19 | * For use in potentially long-running computations that might need to be cancelled 20 | */ 21 | trait CancellationChecker { 22 | def throwIfCancelled(): Unit 23 | } 24 | 25 | object CancellationChecker { 26 | 27 | /** 28 | * A CancellationChecker that never throws 29 | */ 30 | object NeverCancelled extends CancellationChecker { 31 | override def throwIfCancelled(): Unit = () 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/CypherException.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util 17 | 18 | abstract class CypherException(protected val message: String, cause: Throwable) 19 | extends RuntimeException(message, cause) { 20 | def this(message: String) = this(message, null) 21 | } 22 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/CypherExceptionFactory.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util 17 | 18 | trait CypherExceptionFactory { 19 | def arithmeticException(message: String, cause: Exception = null): Exception 20 | def syntaxException(message: String, pos: InputPosition): Exception 21 | } 22 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/DummyPosition.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util 17 | 18 | object DummyPosition { 19 | def apply(offset: Int) = new InputPosition(offset, 1, offset) 20 | } 21 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/NameId.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util 17 | 18 | import scala.language.implicitConversions 19 | 20 | sealed trait NameId { 21 | def id: Int 22 | } 23 | 24 | final case class LabelId(id: Int) extends NameId 25 | final case class RelTypeId(id: Int) extends NameId 26 | final case class PropertyKeyId(id: Int) extends NameId 27 | 28 | object NameId { 29 | val WILDCARD: Int = -1 30 | 31 | implicit def toKernelEncode(nameId: NameId): Int = nameId.id 32 | implicit def toKernelEncode(nameId: Option[NameId]): Int = nameId.map(toKernelEncode).getOrElse(WILDCARD) 33 | } 34 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/ObfuscationMetadata.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util 17 | 18 | final case class ObfuscationMetadata( 19 | sensitiveLiteralOffsets: Vector[LiteralOffset], 20 | sensitiveParameterNames: Set[String] 21 | ) { 22 | def isEmpty: Boolean = sensitiveLiteralOffsets.isEmpty && sensitiveParameterNames.isEmpty 23 | } 24 | 25 | case class LiteralOffset(start: Int, length: Option[Int]) 26 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/Repetition.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util 17 | 18 | case class Repetition(min: Long, max: UpperBound) 19 | 20 | sealed trait UpperBound { 21 | def isGreaterThan(count: Long): Boolean 22 | } 23 | 24 | object UpperBound { 25 | 26 | def unlimited: UpperBound = Unlimited 27 | 28 | case object Unlimited extends UpperBound { 29 | override def isGreaterThan(count: Long): Boolean = true 30 | } 31 | 32 | case class Limited(n: Long) extends UpperBound { 33 | override def isGreaterThan(count: Long): Boolean = count < n 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/ZeroOneOrMany.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util 17 | 18 | sealed trait ZeroOneOrMany[+T] 19 | 20 | object ZeroOneOrMany { 21 | 22 | def apply[T](elts: Seq[T]): ZeroOneOrMany[T] = elts match { 23 | case Seq() => Zero 24 | case Seq(one) => One(one) 25 | case many => Many(many) 26 | } 27 | } 28 | 29 | case object Zero extends ZeroOneOrMany[Nothing] 30 | final case class One[T](value: T) extends ZeroOneOrMany[T] 31 | final case class Many[T](values: Seq[T]) extends ZeroOneOrMany[T] 32 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/package.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0 17 | 18 | package object util { 19 | type Rewriter = AnyRef => AnyRef 20 | type RewriterWithParent = ((AnyRef, Option[AnyRef])) => AnyRef 21 | type CartesianOrdering = Ordering[(Cost, Cardinality)] 22 | } 23 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/AnyType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object AnyType { 19 | 20 | val instance: AnyType = new AnyType() { 21 | val parentType: AnyType = this 22 | override val isAbstract = true 23 | 24 | override def isAssignableFrom(other: CypherType): Boolean = true 25 | 26 | override val toString = "Any" 27 | override val toNeoTypeString = "ANY?" 28 | } 29 | } 30 | 31 | sealed abstract class AnyType extends CypherType 32 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/BooleanType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object BooleanType { 19 | 20 | val instance = new BooleanType() { 21 | val parentType = CTAny 22 | override val toString = "Boolean" 23 | override val toNeoTypeString = "BOOLEAN?" 24 | } 25 | } 26 | 27 | sealed abstract class BooleanType extends CypherType 28 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/FloatType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object FloatType { 19 | 20 | val instance = new FloatType() { 21 | val parentType = CTNumber 22 | override val toString = "Float" 23 | override val toNeoTypeString = "FLOAT?" 24 | } 25 | } 26 | 27 | sealed abstract class FloatType extends CypherType 28 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/GeometryType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object GeometryType { 19 | 20 | val instance = new GeometryType() { 21 | val parentType = CTAny 22 | override val toString = "Geometry" 23 | 24 | override def toNeoTypeString = "GEOMETRY?" 25 | } 26 | } 27 | 28 | sealed abstract class GeometryType extends CypherType 29 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/GraphRefType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object GraphRefType { 19 | 20 | val instance = new GraphRefType() { 21 | override val parentType = CTAny 22 | override val toString = "GraphRef" 23 | override val toNeoTypeString = "GRAPHREF?" 24 | } 25 | } 26 | 27 | sealed trait GraphRefType extends CypherType 28 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/IntegerType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object IntegerType { 19 | 20 | val instance = new IntegerType() { 21 | val parentType = CTNumber 22 | override lazy val coercibleTo: Set[CypherType] = Set(CTFloat) ++ parentType.coercibleTo 23 | override val toString = "Integer" 24 | override val toNeoTypeString = "INTEGER?" 25 | } 26 | } 27 | 28 | sealed abstract class IntegerType extends CypherType 29 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/MapType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object MapType { 19 | 20 | val instance = new MapType() { 21 | val parentType = CTAny 22 | override val toString = "Map" 23 | override val toNeoTypeString = "MAP?" 24 | } 25 | } 26 | 27 | sealed abstract class MapType extends CypherType 28 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/NodeType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object NodeType { 19 | 20 | val instance = new NodeType() { 21 | val parentType = CTMap 22 | override val toString = "Node" 23 | override val toNeoTypeString = "NODE?" 24 | } 25 | } 26 | 27 | sealed abstract class NodeType extends CypherType 28 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/NumberType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object NumberType { 19 | 20 | val instance = new NumberType() { 21 | val parentType = CTAny 22 | override val isAbstract = true 23 | override val toString = "Number" 24 | override val toNeoTypeString = "NUMBER?" 25 | } 26 | } 27 | 28 | sealed abstract class NumberType extends CypherType 29 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/PathType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object PathType { 19 | 20 | val instance = new PathType() { 21 | val parentType = CTAny 22 | override val toString = "Path" 23 | override val toNeoTypeString = "PATH?" 24 | } 25 | } 26 | 27 | sealed abstract class PathType extends CypherType 28 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/PointType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object PointType { 19 | 20 | val instance = new PointType() { 21 | val parentType = CTAny 22 | override val toString = "Point" 23 | override val toNeoTypeString = "POINT?" 24 | } 25 | } 26 | 27 | sealed abstract class PointType extends CypherType 28 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/RelationshipType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object RelationshipType { 19 | 20 | val instance = new RelationshipType() { 21 | val parentType = CTMap 22 | override val toString = "Relationship" 23 | override val toNeoTypeString = "RELATIONSHIP?" 24 | } 25 | } 26 | 27 | sealed abstract class RelationshipType extends CypherType 28 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/StorableType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object StorableType { 19 | 20 | /** 21 | * The type of a property stored in a Node or Relationship 22 | */ 23 | val storableType: TypeSpec = 24 | CTBoolean | CTNumber.covariant | CTPoint | CTString | CTDuration | CTDate | CTTime | CTLocalTime | CTLocalDateTime | CTDateTime | 25 | CTList(CTBoolean) | CTList(CTNumber) | CTList(CTInteger) | CTList(CTFloat) | CTList(CTPoint) | CTList( 26 | CTString 27 | ) | CTList(CTDuration) | CTList(CTDate) | 28 | CTList(CTTime) | CTList(CTLocalTime) | CTList(CTLocalDateTime) | CTList(CTDateTime) 29 | } 30 | -------------------------------------------------------------------------------- /util/src/main/scala/org/opencypher/v9_0/util/symbols/StringType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.symbols 17 | 18 | object StringType { 19 | 20 | val instance = new StringType() { 21 | val parentType = CTAny 22 | override val toString = "String" 23 | override val toNeoTypeString = "STRING?" 24 | } 25 | } 26 | 27 | sealed trait StringType extends CypherType 28 | -------------------------------------------------------------------------------- /util/src/test/scala/org/opencypher/v9_0/util/PredicateOrderingTest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util 17 | 18 | import org.opencypher.v9_0.util.test_helpers.CypherFunSuite 19 | 20 | class PredicateOrderingTest extends CypherFunSuite { 21 | 22 | test("should not break transitivity due to floating point precision") { 23 | val a = (CostPerRow(4.0), Selectivity.ONE) 24 | val b = (CostPerRow(8.0), Selectivity.ONE) 25 | val c = (CostPerRow(8.0), Selectivity(0.9999999999999998)) 26 | 27 | // a = b = c 28 | PredicateOrdering.equiv(a, b) shouldBe true 29 | PredicateOrdering.equiv(b, c) shouldBe true 30 | PredicateOrdering.equiv(a, c) shouldBe true 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /util/src/test/scala/org/opencypher/v9_0/util/ZeroOneOrManyTest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util 17 | 18 | import org.opencypher.v9_0.util.test_helpers.CypherFunSuite 19 | 20 | class ZeroOneOrManyTest extends CypherFunSuite { 21 | 22 | test("zero") { 23 | ZeroOneOrMany(Seq.empty) should be(Zero) 24 | } 25 | 26 | test("one") { 27 | ZeroOneOrMany(Seq(Symbol("a"))) should be(One(Symbol("a"))) 28 | } 29 | 30 | test("many") { 31 | ZeroOneOrMany(Seq(Symbol("a"), Symbol("b"))) should be(Many(Seq(Symbol("a"), Symbol("b")))) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /util/src/test/scala/org/opencypher/v9_0/util/helpers/LineBreakRemoverTest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Neo4j Sweden AB (http://neo4j.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opencypher.v9_0.util.helpers 17 | 18 | import org.opencypher.v9_0.util.helpers.LineBreakRemover.removeLineBreaks 19 | import org.opencypher.v9_0.util.test_helpers.CypherFunSuite 20 | 21 | class LineBreakRemoverTest extends CypherFunSuite { 22 | 23 | test("should do nothing when no line breaks") { 24 | removeLineBreaks("a bc") should equal("a bc") 25 | } 26 | 27 | test("should remove line breaks") { 28 | removeLineBreaks("\na \rb\n c\n") should equal("a b c") 29 | } 30 | } 31 | --------------------------------------------------------------------------------