├── .github ├── FUNDING.yml └── workflows │ └── build-plugin.yaml ├── .gitignore ├── CHANGELOG.md ├── LICENSE.txt ├── README.md ├── book.json ├── build.gradle ├── bytecodedl-neo4j-plugin.gif ├── config └── checkstyle │ ├── checkstyle.xml │ └── suppression.xml ├── database ├── api │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── albertoventurini │ │ └── graphdbplugin │ │ └── database │ │ └── api │ │ ├── GraphDatabaseApi.java │ │ ├── data │ │ ├── GraphDatabaseVersion.java │ │ ├── GraphEntity.java │ │ ├── GraphMetadata.java │ │ ├── GraphNode.java │ │ ├── GraphPath.java │ │ ├── GraphPropertyContainer.java │ │ ├── GraphRelationship.java │ │ └── NoIdGraphEntity.java │ │ └── query │ │ ├── GraphQueryNotification.java │ │ ├── GraphQueryPlan.java │ │ ├── GraphQueryResult.java │ │ ├── GraphQueryResultColumn.java │ │ └── GraphQueryResultRow.java ├── build.gradle └── neo4j │ ├── build.gradle │ └── src │ └── main │ └── java │ └── com │ └── albertoventurini │ └── graphdbplugin │ └── database │ └── neo4j │ ├── bolt │ ├── Neo4jBoltBuffer.java │ ├── Neo4jBoltConfiguration.java │ ├── Neo4jBoltDatabase.java │ ├── data │ │ ├── Neo4jBoltNode.java │ │ ├── Neo4jBoltPath.java │ │ ├── Neo4jBoltPropertyContainer.java │ │ ├── Neo4jBoltQueryNotification.java │ │ ├── Neo4jBoltRelationship.java │ │ └── Neo4jGraphDatabaseVersion.java │ └── query │ │ ├── Neo4jBoltQueryPlan.java │ │ ├── Neo4jBoltQueryResult.java │ │ ├── Neo4jBoltQueryResultColumn.java │ │ └── Neo4jBoltQueryResultRow.java │ ├── bytecodedl │ ├── InvocationSignature.java │ └── MethodSignature.java │ └── rest │ └── .gitkeep ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── graph-database-plugin ├── build.gradle └── src │ └── main │ └── resources │ ├── META-INF │ ├── intellilang-cypher-support.xml │ ├── plugin.xml │ ├── pluginIcon.svg │ └── pluginIcon_dark.svg │ ├── inspectionDescriptions │ └── CypherExplainWarning.html │ ├── javaInjections.xml │ └── pythonInjections.xml ├── language ├── build.gradle └── cypher │ ├── build.gradle │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── albertoventurini │ │ │ └── graphdbplugin │ │ │ └── language │ │ │ └── cypher │ │ │ ├── CypherIcons.java │ │ │ ├── CypherLanguage.java │ │ │ ├── CypherParserDefinition.java │ │ │ ├── commenter │ │ │ └── CypherCommenter.java │ │ │ ├── completion │ │ │ ├── CypherCompletionContributor.java │ │ │ ├── metadata │ │ │ │ ├── CypherMetadataContainer.java │ │ │ │ ├── CypherMetadataProviderService.java │ │ │ │ ├── CypherMetadataProviderServiceImpl.java │ │ │ │ ├── atoms │ │ │ │ │ ├── CypherBuiltInFunctions.java │ │ │ │ │ ├── CypherKeywords.java │ │ │ │ │ ├── CypherList.java │ │ │ │ │ ├── CypherSimpleType.java │ │ │ │ │ └── CypherType.java │ │ │ │ └── elements │ │ │ │ │ ├── CypherBuiltInFunctionElement.java │ │ │ │ │ ├── CypherElement.java │ │ │ │ │ ├── CypherElementWithDocumentation.java │ │ │ │ │ ├── CypherElementWithSignature.java │ │ │ │ │ ├── CypherFunctionElement.java │ │ │ │ │ ├── CypherKeywordElement.java │ │ │ │ │ ├── CypherLabelElement.java │ │ │ │ │ ├── CypherProcedureElement.java │ │ │ │ │ ├── CypherPropertyKeyElement.java │ │ │ │ │ ├── CypherRelationshipTypeElement.java │ │ │ │ │ └── InvokableInformation.java │ │ │ └── providers │ │ │ │ ├── BaseCompletionProvider.java │ │ │ │ ├── FunctionsCompletionProvider.java │ │ │ │ ├── KeywordCompletionProvider.java │ │ │ │ ├── LabelsCompletionProvider.java │ │ │ │ ├── ProceduresCompletionProvider.java │ │ │ │ ├── PropertyKeyCompletionProvider.java │ │ │ │ └── RelationshipTypeCompletionProvider.java │ │ │ ├── documentation │ │ │ ├── CypherDocumentationProvider.java │ │ │ └── database │ │ │ │ ├── CypherDocumentation.java │ │ │ │ └── DocumentationStorage.java │ │ │ ├── editor │ │ │ ├── CypherParameterInfoHandler.java │ │ │ └── CypherTypedHandlerDelegate.java │ │ │ ├── file │ │ │ ├── CypherFile.java │ │ │ └── CypherFileType.java │ │ │ ├── formatter │ │ │ ├── CypherBlock.java │ │ │ ├── CypherFormattingModelBuilder.java │ │ │ ├── CypherPreFormatter.java │ │ │ └── converter │ │ │ │ ├── AbstractCypherConverter.java │ │ │ │ ├── FunctionCaseConverter.java │ │ │ │ ├── KeywordCaseConverter.java │ │ │ │ └── QuotesConverter.java │ │ │ ├── highlight │ │ │ ├── CypherSyntaxColors.java │ │ │ ├── CypherSyntaxHighlighter.java │ │ │ ├── CypherSyntaxHighlighterAnnotator.java │ │ │ └── CypherSyntaxHighlighterFactory.java │ │ │ ├── inspections │ │ │ └── CypherFunctionCallInspection.java │ │ │ ├── lang │ │ │ ├── CypherBraceMatcher.java │ │ │ ├── CypherNameValidator.java │ │ │ ├── CypherRegexp.java │ │ │ └── CypherSpellcheckingStrategy.java │ │ │ ├── lexer │ │ │ ├── Cypher.bnf │ │ │ ├── CypherLexer.flex │ │ │ └── CypherLexerAdapter.java │ │ │ ├── psi │ │ │ ├── CypherElementFactory.java │ │ │ ├── CypherElementType.java │ │ │ ├── CypherPsiImplUtil.java │ │ │ ├── CypherTokenType.java │ │ │ └── impl │ │ │ │ ├── CypherAllFunctionInvocationImplMixin.java │ │ │ │ ├── CypherAnyFunctionInvocationImplMixin.java │ │ │ │ ├── CypherExistsFunctionInvocationImplMixin.java │ │ │ │ ├── CypherExtractFunctionInvocationImplMixin.java │ │ │ │ ├── CypherFilterFunctionInvocationImplMixin.java │ │ │ │ ├── CypherFunctionInvocationImplMixin.java │ │ │ │ ├── CypherLabelNameImplMixin.java │ │ │ │ ├── CypherNoneFunctionInvocationImplMixin.java │ │ │ │ ├── CypherParameterImplMixin.java │ │ │ │ ├── CypherProcedureInvocationImplMixin.java │ │ │ │ ├── CypherPropertyKeyNameImplMixin.java │ │ │ │ ├── CypherReduceFunctionInvocationImplMixin.java │ │ │ │ ├── CypherRelTypeNameImplMixin.java │ │ │ │ ├── CypherSingleFunctionInvocationImplMixin.java │ │ │ │ └── CypherVariableElementImplMixin.java │ │ │ ├── references │ │ │ ├── CypherArgumentList.java │ │ │ ├── CypherInvocation.java │ │ │ ├── CypherNamedElement.java │ │ │ ├── CypherNamedElementImpl.java │ │ │ ├── CypherParenthesized.java │ │ │ ├── CypherRefactoringSupportProvider.java │ │ │ ├── CypherReferenceBase.java │ │ │ ├── CypherReferenceContributionPriority.java │ │ │ ├── CypherReferenceContributor.java │ │ │ ├── CypherRenameInputValidator.java │ │ │ ├── CypherVariableElement.java │ │ │ ├── CypherVariableElementImpl.java │ │ │ ├── impl │ │ │ │ ├── CypherLabelNameReference.java │ │ │ │ ├── CypherPropertyKeyNameReference.java │ │ │ │ ├── CypherRelTypeNameReference.java │ │ │ │ └── CypherVariableReference.java │ │ │ └── types │ │ │ │ ├── CypherAnyYielding.java │ │ │ │ ├── CypherBooleanYielding.java │ │ │ │ ├── CypherFloatYielding.java │ │ │ │ ├── CypherIntegerYielding.java │ │ │ │ ├── CypherListYielding.java │ │ │ │ ├── CypherMapYielding.java │ │ │ │ ├── CypherNodeYielding.java │ │ │ │ ├── CypherNullYielding.java │ │ │ │ ├── CypherPathYielding.java │ │ │ │ ├── CypherRelationshipYielding.java │ │ │ │ ├── CypherStringYielding.java │ │ │ │ ├── CypherTypePropagator.java │ │ │ │ └── CypherTyped.java │ │ │ ├── settings │ │ │ └── CypherColorSettingsPage.java │ │ │ └── util │ │ │ ├── CypherUtil.java │ │ │ ├── FileTypeExtensionUtil.java │ │ │ ├── PsiTraversalUtilities.java │ │ │ ├── PsiUtil.java │ │ │ └── TraverseUtil.java │ └── resources │ │ ├── com │ │ └── albertoventurini │ │ │ └── graphdbplugin │ │ │ └── language │ │ │ └── cypher │ │ │ └── documentation │ │ │ └── database │ │ │ └── built-in │ │ │ └── functions │ │ │ ├── allShortestPaths.html │ │ │ ├── coalesce.html │ │ │ ├── shortestPath.html │ │ │ └── timestamp.html │ │ └── inspectionDescriptions │ │ └── CypherFunctionCall.html │ └── test │ └── java │ └── com │ └── albertoventurini │ └── graphdbplugin │ └── language │ └── cypher │ ├── completion │ └── metadata │ │ └── elements │ │ └── CypherProcedureElementTest.java │ └── documentation │ └── database │ └── CypherDocumentationTest.java ├── log.txt ├── platform ├── build.gradle └── src │ ├── main │ ├── java │ │ ├── com │ │ │ └── albertoventurini │ │ │ │ └── graphdbplugin │ │ │ │ └── platform │ │ │ │ ├── GraphBundle.java │ │ │ │ ├── GraphConstants.java │ │ │ │ ├── ShouldNeverHappenException.java │ │ │ │ └── SupportedLanguage.java │ │ └── icons │ │ │ └── GraphIcons.java │ └── resources │ │ └── graphdb │ │ ├── icons │ │ ├── database │ │ │ └── neo4j.svg │ │ └── language │ │ │ └── cypher.svg │ │ └── messages │ │ └── GraphBundle.properties │ └── test │ └── java │ └── com │ └── albertoventurini │ └── graphdbplugin │ └── language │ └── cypher │ └── SupportedLanguageTest.java ├── release-and-publish.sh ├── settings.gradle ├── testing ├── build.gradle ├── common │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── albertoventurini │ │ └── graphdbplugin │ │ └── test │ │ └── mocks │ │ └── service │ │ └── DummyExecutorService.java ├── integration-neo4j │ ├── build.gradle │ └── src │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── albertoventurini │ │ │ └── graphdbplugin │ │ │ └── test │ │ │ └── integration │ │ │ └── neo4j │ │ │ ├── tests │ │ │ ├── cypher │ │ │ │ ├── completion │ │ │ │ │ ├── FunctionCompletionTest.java │ │ │ │ │ ├── KeywordsCompletionTest.java │ │ │ │ │ └── StoredProcedureCompletionTest.java │ │ │ │ ├── documentation │ │ │ │ │ ├── AutoGeneratedProcedureDocumentationTest.java │ │ │ │ │ ├── AutoGeneratedUserFunctionDocumentationTest.java │ │ │ │ │ ├── BuiltInFunctionDocumentationTest.java │ │ │ │ │ └── BuiltInSpecialFunctionDocumentationTest.java │ │ │ │ ├── editor │ │ │ │ │ ├── ArgumentHintTest.java │ │ │ │ │ └── BraceMatcherTest.java │ │ │ │ ├── formatting │ │ │ │ │ ├── CommunityFormattingTest.java │ │ │ │ │ └── CypherFormattingTest.java │ │ │ │ ├── inspection │ │ │ │ │ ├── CypherExplainWarningInspectionTest.java │ │ │ │ │ └── CypherFunctionCallInspectionTest.java │ │ │ │ ├── parameters │ │ │ │ │ └── CypherParametersProviderTest.java │ │ │ │ ├── parsing │ │ │ │ │ ├── CommandParsingTest.java │ │ │ │ │ ├── CommentsParsingTest.java │ │ │ │ │ ├── ExpressionsParsingTest.java │ │ │ │ │ ├── IndexCommandParsingTest.java │ │ │ │ │ ├── LexerTest.java │ │ │ │ │ ├── PatternsParsingTest.java │ │ │ │ │ ├── QueryParsingTest.java │ │ │ │ │ ├── ShellParsingTest.java │ │ │ │ │ ├── StatementOptionsParsingTest.java │ │ │ │ │ ├── StatementTraversingTest.java │ │ │ │ │ └── clause │ │ │ │ │ │ └── QueryClauseParsingTest.java │ │ │ │ ├── reference │ │ │ │ │ ├── LabelReferenceContributorTest.java │ │ │ │ │ ├── PropertyReferenceContributorTest.java │ │ │ │ │ └── RelationshipTypeReferenceContributorTest.java │ │ │ │ ├── rename │ │ │ │ │ ├── LabelRenameTest.java │ │ │ │ │ ├── PropertyRenameTest.java │ │ │ │ │ ├── RelationshipTypeRenameTest.java │ │ │ │ │ └── VariableRenameTest.java │ │ │ │ └── util │ │ │ │ │ ├── BaseCodeInsightTest.java │ │ │ │ │ ├── BaseCompletionTest.java │ │ │ │ │ ├── BaseDocumentationTest.java │ │ │ │ │ ├── BaseFormattingTest.java │ │ │ │ │ ├── BaseGenericTest.java │ │ │ │ │ ├── BaseInspectionTest.java │ │ │ │ │ ├── BaseParsingTest.java │ │ │ │ │ └── BaseRenameTest.java │ │ │ ├── database │ │ │ │ ├── common │ │ │ │ │ └── AbstractDataSourceMetadataTest.java │ │ │ │ └── neo4j │ │ │ │ │ └── DataSourceMetadataTest.java │ │ │ └── jetbrains │ │ │ │ └── StatementCollectorTest.java │ │ │ └── util │ │ │ ├── base │ │ │ └── BaseIntegrationTest.java │ │ │ └── server │ │ │ ├── AsyncStartable.java │ │ │ ├── Neo4jContainerServer.java │ │ │ ├── Neo4jContainerServers.java │ │ │ ├── Neo4jServer.java │ │ │ └── Startable.java │ │ └── resources │ │ ├── parsing │ │ ├── command │ │ │ ├── ConstraintPropertyExistsNodeCreate.cyp │ │ │ ├── ConstraintPropertyExistsNodeCreate.txt │ │ │ ├── ConstraintPropertyExistsNodeDrop.cyp │ │ │ ├── ConstraintPropertyExistsNodeDrop.txt │ │ │ ├── ConstraintPropertyExistsRelCreate.cyp │ │ │ ├── ConstraintPropertyExistsRelCreate.txt │ │ │ ├── ConstraintPropertyExistsRelDrop.cyp │ │ │ ├── ConstraintPropertyExistsRelDrop.txt │ │ │ ├── ConstraintPropertyUniqueCreate.cyp │ │ │ ├── ConstraintPropertyUniqueCreate.txt │ │ │ ├── ConstraintPropertyUniqueDrop.cyp │ │ │ └── ConstraintPropertyUniqueDrop.txt │ │ ├── comments │ │ │ ├── Block.cyp │ │ │ ├── Block.txt │ │ │ ├── Line.cyp │ │ │ └── Line.txt │ │ ├── expressions │ │ │ ├── CountFunction.cyp │ │ │ ├── CountFunction.txt │ │ │ ├── Expressions.cyp │ │ │ ├── Expressions.txt │ │ │ ├── KeywordInIdentifier.cyp │ │ │ ├── KeywordInIdentifier.txt │ │ │ ├── MapProjection.cyp │ │ │ ├── MapProjection.txt │ │ │ ├── Parameters.cyp │ │ │ ├── Parameters.txt │ │ │ ├── PatternComprehension.cyp │ │ │ ├── PatternComprehension.txt │ │ │ ├── SpecialFunctions.cyp │ │ │ ├── SpecialFunctions.txt │ │ │ ├── UserFunction.cyp │ │ │ └── UserFunction.txt │ │ ├── indexes │ │ │ ├── CreateIndexIfNotExists.cyp │ │ │ ├── CreateIndexIfNotExists.txt │ │ │ ├── CreateIndexOnRelationships.cyp │ │ │ ├── CreateIndexOnRelationships.txt │ │ │ ├── CreateIndexWithOptions.cyp │ │ │ ├── CreateIndexWithOptions.txt │ │ │ ├── CreateLookupIndex.cyp │ │ │ ├── CreateLookupIndex.txt │ │ │ ├── CreateNamedIndex.cyp │ │ │ ├── CreateNamedIndex.txt │ │ │ ├── CreatePointIndex.cyp │ │ │ ├── CreatePointIndex.txt │ │ │ ├── CreateRangeIndex.cyp │ │ │ ├── CreateRangeIndex.txt │ │ │ ├── CreateTextIndex.cyp │ │ │ ├── CreateTextIndex.txt │ │ │ ├── CreateUnnamedIndex.cyp │ │ │ ├── CreateUnnamedIndex.txt │ │ │ ├── DropIndex.cyp │ │ │ └── DropIndex.txt │ │ ├── lexer │ │ │ ├── HexNumbers.cyp │ │ │ ├── HexNumbers.txt │ │ │ ├── OctalNumbers.cyp │ │ │ ├── OctalNumbers.txt │ │ │ ├── ScientificNotation.cyp │ │ │ └── ScientificNotation.txt │ │ ├── patterns │ │ │ ├── Patterns.cyp │ │ │ ├── Patterns.txt │ │ │ ├── WhereInsidePatterns.cyp │ │ │ └── WhereInsidePatterns.txt │ │ ├── query │ │ │ ├── MultipleQueries.cyp │ │ │ ├── MultipleQueries.txt │ │ │ └── clause │ │ │ │ ├── Call.cyp │ │ │ │ ├── Call.txt │ │ │ │ ├── Create.cyp │ │ │ │ ├── Create.txt │ │ │ │ ├── Delete.cyp │ │ │ │ ├── Delete.txt │ │ │ │ ├── Foreach.cyp │ │ │ │ ├── Foreach.txt │ │ │ │ ├── LoadCSV.cyp │ │ │ │ ├── LoadCSV.txt │ │ │ │ ├── Match.cyp │ │ │ │ ├── Match.txt │ │ │ │ ├── Merge.cyp │ │ │ │ ├── Merge.txt │ │ │ │ ├── Remove.cyp │ │ │ │ ├── Remove.txt │ │ │ │ ├── Return.cyp │ │ │ │ ├── Return.txt │ │ │ │ ├── Set.cyp │ │ │ │ ├── Set.txt │ │ │ │ ├── Start.cyp │ │ │ │ ├── Start.txt │ │ │ │ ├── SubQueries.cyp │ │ │ │ ├── SubQueries.txt │ │ │ │ ├── SubQueriesInTransactions.cyp │ │ │ │ ├── SubQueriesInTransactions.txt │ │ │ │ ├── Union.cyp │ │ │ │ ├── Union.txt │ │ │ │ ├── Unwind.cyp │ │ │ │ ├── Unwind.txt │ │ │ │ ├── With.cyp │ │ │ │ └── With.txt │ │ ├── shell │ │ │ ├── Keywords.cyp │ │ │ └── Keywords.txt │ │ └── statement-options │ │ │ ├── StatementOptions.cyp │ │ │ └── StatementOptions.txt │ │ └── rename │ │ ├── label │ │ ├── MultipleQueries.cyp │ │ ├── MultipleQueriesAfter.cyp │ │ ├── SingleQuery.cyp │ │ └── SingleQueryAfter.cyp │ │ ├── property │ │ ├── MultipleQueries.cyp │ │ ├── MultipleQueriesAfter.cyp │ │ ├── SingleQuery.cyp │ │ └── SingleQueryAfter.cyp │ │ ├── relationship_type │ │ ├── MultipleQueries.cyp │ │ ├── MultipleQueriesAfter.cyp │ │ ├── SingleQuery.cyp │ │ └── SingleQueryAfter.cyp │ │ └── variable │ │ ├── MultipleQueries.cyp │ │ ├── MultipleQueriesAfter.cyp │ │ ├── SingleQuery.cyp │ │ └── SingleQueryAfter.cyp └── manual │ ├── build.gradle │ └── src │ └── test │ └── java │ └── com │ └── albertoventurini │ └── graphdbplugin │ └── TestSimpleGraph.java └── ui ├── build.gradle ├── jetbrains ├── build.gradle └── src │ ├── main │ └── java │ │ └── com │ │ └── albertoventurini │ │ └── graphdbplugin │ │ └── jetbrains │ │ ├── actions │ │ ├── execute │ │ │ ├── ChooseDataSourceAction.java │ │ │ ├── ChooseDataSourceActionGroup.java │ │ │ ├── ExecuteAllAction.java │ │ │ ├── ExecuteQueryAction.java │ │ │ ├── ExecuteQueryActionPromoter.java │ │ │ ├── ExecuteQueryEvent.java │ │ │ ├── ExecuteQueryPayload.java │ │ │ ├── ExplainQueryAction.java │ │ │ ├── LandingPageAction.java │ │ │ ├── ProfileQueryAction.java │ │ │ ├── QueryAction.java │ │ │ └── StatementCollector.java │ │ └── ui │ │ │ └── console │ │ │ ├── CleanCanvasAction.java │ │ │ ├── CleanCanvasEvent.java │ │ │ ├── CopyQueryOutputAction.java │ │ │ └── ToggleFileSpecificParametersEvent.java │ │ ├── component │ │ ├── datasource │ │ │ ├── DataSourceDescription.java │ │ │ ├── DataSourceType.java │ │ │ ├── DataSourcesComponent.java │ │ │ ├── metadata │ │ │ │ ├── DataSourceMetadata.java │ │ │ │ ├── DataSourcesComponentMetadata.java │ │ │ │ ├── MetadataBuilder.java │ │ │ │ └── neo4j │ │ │ │ │ ├── Neo4jConstraintMetadata.java │ │ │ │ │ ├── Neo4jFunctionMetadata.java │ │ │ │ │ ├── Neo4jIndexMetadata.java │ │ │ │ │ ├── Neo4jLabelMetadata.java │ │ │ │ │ ├── Neo4jMetadata.java │ │ │ │ │ ├── Neo4jMetadataBuilder.java │ │ │ │ │ ├── Neo4jProcedureMetadata.java │ │ │ │ │ └── Neo4jRelationshipTypeMetadata.java │ │ │ └── state │ │ │ │ ├── DataSourceApi.java │ │ │ │ ├── DataSourceContainer.java │ │ │ │ ├── DataSourcesComponentState.java │ │ │ │ ├── container │ │ │ │ └── DataSourceContainerV1.java │ │ │ │ └── impl │ │ │ │ ├── DataSource.java │ │ │ │ └── DataSourceV1.java │ │ ├── highlighter │ │ │ ├── QueryHighlighterComponent.java │ │ │ ├── QueryHighlighterComponentImpl.java │ │ │ ├── SyncedElementHighlighter.java │ │ │ └── listener │ │ │ │ ├── QueryHighlighterCaretListener.java │ │ │ │ └── QueryHighlighterDocumentListener.java │ │ ├── linemarker │ │ │ └── CypherLineMarkerProvider.java │ │ ├── settings │ │ │ ├── SettingsComponent.java │ │ │ └── SettingsComponentImpl.java │ │ └── updater │ │ │ └── PluginUpdateActivity.java │ │ ├── configuration │ │ └── GraphDatabaseConfiguration.java │ │ ├── database │ │ ├── DatabaseManagerService.java │ │ ├── DatabaseManagerServiceImpl.java │ │ ├── DiffService.java │ │ ├── QueryExecutionService.java │ │ └── VersionService.java │ │ ├── formatter │ │ ├── CypherCodeStyleSettings.java │ │ ├── CypherCodeStyleSettingsProvider.java │ │ └── CypherLanguageCodeStyleSettingsProvider.java │ │ ├── inspection │ │ └── CypherExplainWarningInspection.java │ │ ├── services │ │ ├── ExecutorService.java │ │ ├── ExecutorServiceImpl.java │ │ └── IdeaLookAndFeelService.java │ │ ├── ui │ │ ├── console │ │ │ ├── ConsoleToolWindow.java │ │ │ ├── GraphConsoleView.form │ │ │ ├── GraphConsoleView.java │ │ │ ├── event │ │ │ │ ├── CopyQueryOutputEvent.java │ │ │ │ ├── OpenTabEvent.java │ │ │ │ ├── PluginSettingsUpdated.java │ │ │ │ ├── QueryExecutionProcessEvent.java │ │ │ │ ├── QueryParametersRetrievalErrorEvent.java │ │ │ │ ├── QueryPlanEvent.java │ │ │ │ └── VersionFetchingProcessEvent.java │ │ │ ├── graph │ │ │ │ ├── AbstractRelationshipCurdAction.java │ │ │ │ ├── CopyToClipboardAction.java │ │ │ │ ├── EdgeNavigateAction.java │ │ │ │ ├── EntityActionGroup.java │ │ │ │ ├── EntityContextMenu.java │ │ │ │ ├── GraphPanel.java │ │ │ │ ├── GraphPanelInteractions.java │ │ │ │ ├── NodeDeleteAction.java │ │ │ │ ├── NodeEditAction.java │ │ │ │ ├── NodeNavigateAction.java │ │ │ │ ├── PsiInvocationSignature.java │ │ │ │ ├── PsiMethodSignature.java │ │ │ │ ├── RelationshipAllDeleteAction.java │ │ │ │ ├── RelationshipDeleteAction.java │ │ │ │ ├── RelationshipEditAction.java │ │ │ │ └── RelationshipOnlyLeaveAction.java │ │ │ ├── log │ │ │ │ ├── GoToTabFilter.java │ │ │ │ └── LogPanel.java │ │ │ ├── params │ │ │ │ ├── ParameterRootType.java │ │ │ │ ├── ParametersPanel.java │ │ │ │ ├── ParametersProvider.java │ │ │ │ └── ParametersService.java │ │ │ ├── plan │ │ │ │ ├── ColumnDefinitions.java │ │ │ │ ├── QueryPlanArgumentKeys.java │ │ │ │ └── QueryPlanPanel.java │ │ │ ├── status │ │ │ │ ├── ExecutionStatusBarWidget.java │ │ │ │ └── ExecutionTextPanel.java │ │ │ └── table │ │ │ │ ├── ColumnResizer.java │ │ │ │ ├── QueryResultTableModel.java │ │ │ │ ├── TablePanel.java │ │ │ │ ├── ValueConverter.java │ │ │ │ ├── editor │ │ │ │ ├── CompositeTableCellEditor.java │ │ │ │ └── TreeModelTableCellEditor.java │ │ │ │ └── renderer │ │ │ │ ├── CompositeTableCellRenderer.java │ │ │ │ └── TreeModelTableCellRenderer.java │ │ ├── datasource │ │ │ ├── DataSourcesToolWindow.java │ │ │ ├── DataSourcesView.form │ │ │ ├── DataSourcesView.java │ │ │ ├── actions │ │ │ │ ├── CreateNodeAction.java │ │ │ │ ├── DataSourceAction.java │ │ │ │ ├── DataSourceActionGroup.java │ │ │ │ ├── DataSourceOpenBrowserAction.java │ │ │ │ └── RefreshDataSourcesAction.java │ │ │ ├── interactions │ │ │ │ ├── DataSourceDialog.java │ │ │ │ ├── DataSourceInteractions.java │ │ │ │ ├── EditEntityDialog.form │ │ │ │ ├── EditEntityDialog.java │ │ │ │ ├── GraphDbEditorsConsoleRootType.java │ │ │ │ ├── NewDataSourceAction.java │ │ │ │ ├── NewDataSourceActionGroup.java │ │ │ │ ├── NotImplementedDataSourceAction.java │ │ │ │ └── neo4j │ │ │ │ │ └── bolt │ │ │ │ │ ├── Neo4jBoltDataSourceDialog.form │ │ │ │ │ └── Neo4jBoltDataSourceDialog.java │ │ │ ├── metadata │ │ │ │ ├── DataSourceMetadataUpdateService.java │ │ │ │ ├── DataSourceTreeUpdater.java │ │ │ │ ├── DataSourceTreeUpdaters.java │ │ │ │ ├── MetadataRetrieveEvent.java │ │ │ │ ├── Neo4jBoltTreeUpdater.java │ │ │ │ ├── actions │ │ │ │ │ ├── MetadataAction.java │ │ │ │ │ ├── MetadataActionGroup.java │ │ │ │ │ ├── MetadataLabelAction.java │ │ │ │ │ ├── MetadataLabelFromAction.java │ │ │ │ │ ├── MetadataLabelToAction.java │ │ │ │ │ ├── MetadataPropertyKeyAction.java │ │ │ │ │ └── MetadataRelationshipAction.java │ │ │ │ └── dto │ │ │ │ │ ├── ContextMenu.java │ │ │ │ │ ├── DataSourceContextMenu.java │ │ │ │ │ └── MetadataContextMenu.java │ │ │ └── tree │ │ │ │ ├── ContextMenuService.java │ │ │ │ ├── DataSourceTreeNodeModel.java │ │ │ │ ├── GraphColoredTreeCellRenderer.java │ │ │ │ ├── LabelTreeNodeModel.java │ │ │ │ ├── MetadataTreeNodeModel.java │ │ │ │ ├── Neo4jEntityViewNodeType.java │ │ │ │ ├── Neo4jTreeNodeType.java │ │ │ │ ├── NodeType.java │ │ │ │ ├── RelationshipTypeTreeNodeModel.java │ │ │ │ ├── RootTreeNodeModel.java │ │ │ │ ├── TableContextMenuMouseAdapter.java │ │ │ │ ├── TreeMouseAdapter.java │ │ │ │ ├── TreeNodeModelApi.java │ │ │ │ ├── dto │ │ │ │ └── ValueWithIcon.java │ │ │ │ └── model │ │ │ │ ├── LabelsModel.java │ │ │ │ ├── ListModel.java │ │ │ │ ├── MapModel.java │ │ │ │ ├── NodeModel.java │ │ │ │ ├── ObjectModel.java │ │ │ │ ├── PropertiesModel.java │ │ │ │ ├── RelationshipModel.java │ │ │ │ └── RootObjectAwareModel.java │ │ ├── helpers │ │ │ ├── KeyValuePair.java │ │ │ ├── SerialisationHelper.java │ │ │ └── UiHelper.java │ │ └── renderes │ │ │ └── tree │ │ │ └── PropertyTreeCellRenderer.java │ │ └── util │ │ ├── FileUtil.java │ │ ├── NameUtil.java │ │ ├── Notifier.java │ │ ├── PluginUtil.java │ │ └── Validation.java │ └── test │ └── java │ └── com │ └── albertoventurini │ └── graphdbplugin │ └── jetbrains │ ├── component │ └── datasource │ │ └── state │ │ └── DataSourcesComponentStateTest.java │ └── ui │ ├── datasource │ └── metadata │ │ ├── ContextMenuTest.java │ │ ├── DataSourceMetadataUpdateServiceTest.java │ │ └── Neo4JBoltTreeUpdaterTest.java │ └── helpers │ └── UiHelperTest.java └── visualization ├── build.gradle └── src ├── main └── java │ └── com │ └── albertoventurini │ └── graphdbplugin │ └── visualization │ ├── GraphDisplay.java │ ├── PrefuseVisualization.java │ ├── VisualizationApi.java │ ├── constants │ ├── GraphColumns.java │ ├── GraphGroups.java │ └── VisualizationParameters.java │ ├── controls │ └── CustomNeighborHighlightControl.java │ ├── events │ ├── EventType.java │ ├── NodeCallback.java │ └── RelationshipCallback.java │ ├── layouts │ ├── AnimationPacer.java │ ├── CenteredLayout.java │ ├── CustomItemSorter.java │ ├── DynamicForceLayout.java │ └── RepaintAndRepositionAction.java │ ├── listeners │ ├── NodeListener.java │ └── RelationshipListener.java │ ├── renderers │ └── CustomEdgeRenderer.java │ ├── services │ └── LookAndFeelService.java │ ├── settings │ ├── ColorProvider.java │ ├── LayoutProvider.java │ ├── RendererProvider.java │ └── SchemaProvider.java │ └── util │ ├── DisplayUtil.java │ ├── IntersectionUtil.java │ ├── PrefuseUtil.java │ └── RenderingUtil.java └── test └── java └── com └── albertoventurini └── graphdbplugin └── visualization └── util ├── DisplayUtilTest.java └── TestVisualization.java /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko-fi: albertoventurini -------------------------------------------------------------------------------- /.github/workflows/build-plugin.yaml: -------------------------------------------------------------------------------- 1 | name: Build and test 2 | 3 | # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows 4 | on: 5 | pull_request: 6 | branches: 7 | - 'main' 8 | push: 9 | branches: 10 | - 'main' 11 | 12 | jobs: 13 | gradle: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - uses: actions/setup-java@v3 18 | with: 19 | distribution: temurin 20 | java-version: 17 21 | 22 | - name: Setup Gradle 23 | uses: gradle/gradle-build-action@v2 24 | 25 | - name: Execute Gradle build 26 | run: ./gradlew build 27 | 28 | - name: Run tests 29 | run: ./gradlew test 30 | 31 | - name: Run Plugin Verifier 32 | run: ./gradlew :graph-database-plugin:runPluginVerifier -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": "docs", 3 | "structure": { 4 | "readme": "README.md", 5 | "summary": "SUMMARY.md" 6 | }, 7 | "title": "Jetbrains Plugin - Graph Database Support", 8 | "description": "Graph Database support plugin allows you to work with databases without leaving IDE.", 9 | "author": "Neueda Technologies, Ltd", 10 | "plugins": [ 11 | "-search", 12 | "-lunr", 13 | "-sharing" 14 | ], 15 | "pluginsConfig": { 16 | "fontsettings": { 17 | "theme": "white", 18 | "family": "sans", 19 | "size": 2 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bytecodedl-neo4j-plugin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BytecodeDL/graphdb-intellij-plugin/081d805845ad0e1eba5810422ae358a8e4166974/bytecodedl-neo4j-plugin.gif -------------------------------------------------------------------------------- /config/checkstyle/suppression.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /database/api/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | dependencies { 5 | testImplementation "junit:junit:$versionJunit" 6 | testImplementation "org.assertj:assertj-core:$versionAssertj" 7 | } 8 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/GraphDatabaseApi.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.data.GraphDatabaseVersion; 10 | import com.albertoventurini.graphdbplugin.database.api.data.GraphMetadata; 11 | import com.albertoventurini.graphdbplugin.database.api.query.GraphQueryResult; 12 | 13 | import java.util.Map; 14 | 15 | public interface GraphDatabaseApi { 16 | 17 | GraphQueryResult execute(String query); 18 | 19 | GraphQueryResult execute(String query, Map statementParameters); 20 | 21 | GraphMetadata metadata(); 22 | 23 | GraphDatabaseVersion getVersion(); 24 | } 25 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/data/GraphDatabaseVersion.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.data; 8 | 9 | public interface GraphDatabaseVersion { 10 | String toString(); 11 | 12 | String idFunction(); 13 | 14 | Object idToParameter(String id); 15 | } 16 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/data/GraphEntity.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.data; 8 | 9 | import java.util.List; 10 | 11 | public interface GraphEntity extends NoIdGraphEntity { 12 | 13 | String getId(); 14 | 15 | GraphPropertyContainer getPropertyContainer(); 16 | 17 | List getTypes(); 18 | 19 | String getTypesName(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/data/GraphMetadata.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.data; 8 | 9 | import java.util.Map; 10 | 11 | public interface GraphMetadata { 12 | Map labels(); 13 | 14 | Map relationships(); 15 | 16 | Iterable vertexProperties(); 17 | 18 | Iterable edgeProperties(); 19 | } 20 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/data/GraphNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.data; 8 | 9 | public interface GraphNode extends GraphEntity { 10 | 11 | default String getRepresentation() { 12 | return "Node[" + getId() + "]"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/data/GraphPath.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.data; 8 | 9 | import java.util.List; 10 | 11 | public interface GraphPath extends NoIdGraphEntity { 12 | 13 | /** 14 | * Return nodes and relationships. 15 | */ 16 | List getComponents(); 17 | 18 | default boolean isTypesSingle() { 19 | return true; 20 | } 21 | 22 | default String getRepresentation() { 23 | return "Path"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/data/GraphPropertyContainer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.data; 8 | 9 | import java.util.Map; 10 | 11 | public interface GraphPropertyContainer { 12 | 13 | Map getProperties(); 14 | } 15 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/data/GraphRelationship.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.data; 8 | 9 | public interface GraphRelationship extends GraphEntity { 10 | 11 | boolean hasStartAndEndNode(); 12 | 13 | String getStartNodeId(); 14 | 15 | String getEndNodeId(); 16 | 17 | GraphNode getStartNode(); 18 | 19 | GraphNode getEndNode(); 20 | 21 | default String getRepresentation() { 22 | return "Relationship[" + getId() + "]"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/data/NoIdGraphEntity.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.data; 8 | 9 | public interface NoIdGraphEntity { 10 | 11 | boolean isTypesSingle(); 12 | 13 | String getRepresentation(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/query/GraphQueryNotification.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.query; 8 | 9 | public interface GraphQueryNotification { 10 | 11 | String getTitle(); 12 | 13 | String getDescription(); 14 | 15 | Integer getPositionOffset(); 16 | } 17 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/query/GraphQueryPlan.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.query; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | public interface GraphQueryPlan { 13 | 14 | String getOperatorType(); 15 | 16 | Map getArguments(); 17 | 18 | List getIdentifiers(); 19 | 20 | List children(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/query/GraphQueryResult.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.query; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.data.GraphNode; 10 | import com.albertoventurini.graphdbplugin.database.api.data.GraphRelationship; 11 | 12 | import java.util.List; 13 | import java.util.Optional; 14 | 15 | public interface GraphQueryResult { 16 | 17 | long getExecutionTimeMs(); 18 | 19 | String getResultSummary(); 20 | 21 | List getColumns(); 22 | 23 | List getRows(); 24 | 25 | List getNodes(); 26 | 27 | List getRelationships(); 28 | 29 | List getNotifications(); 30 | 31 | boolean hasPlan(); 32 | 33 | boolean isProfilePlan(); 34 | 35 | Optional getPlan(); 36 | } 37 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/query/GraphQueryResultColumn.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.query; 8 | 9 | public interface GraphQueryResultColumn { 10 | 11 | String getName(); 12 | } 13 | -------------------------------------------------------------------------------- /database/api/src/main/java/com/albertoventurini/graphdbplugin/database/api/query/GraphQueryResultRow.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.api.query; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.data.GraphNode; 10 | import com.albertoventurini.graphdbplugin.database.api.data.GraphRelationship; 11 | 12 | import java.util.List; 13 | 14 | public interface GraphQueryResultRow { 15 | 16 | Object getValue(final String columnName); 17 | 18 | Object getValue(GraphQueryResultColumn column); 19 | 20 | List getNodes(); 21 | 22 | List getRelationships(); 23 | } 24 | -------------------------------------------------------------------------------- /database/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | dependencies { 5 | } 6 | -------------------------------------------------------------------------------- /database/neo4j/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | dependencies { 5 | implementation project(':database:api') 6 | implementation "org.neo4j.driver:neo4j-java-driver:$versionNeo4jJavaBoltDriver" 7 | implementation("com.fasterxml.jackson.core:jackson-annotations:$versionJacksonMapper") 8 | } 9 | -------------------------------------------------------------------------------- /database/neo4j/src/main/java/com/albertoventurini/graphdbplugin/database/neo4j/bolt/data/Neo4jBoltPath.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.neo4j.bolt.data; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.data.GraphPath; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | public class Neo4jBoltPath implements GraphPath { 15 | 16 | private List pathComponents; 17 | 18 | public Neo4jBoltPath() { 19 | this.pathComponents = new ArrayList<>(); 20 | } 21 | 22 | public Neo4jBoltPath(List pathComponents) { 23 | this.pathComponents = new ArrayList<>(pathComponents); 24 | } 25 | 26 | public void add(Object object) { 27 | pathComponents.add(object); 28 | } 29 | 30 | @Override 31 | public List getComponents() { 32 | return pathComponents; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/neo4j/src/main/java/com/albertoventurini/graphdbplugin/database/neo4j/bolt/data/Neo4jBoltPropertyContainer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.neo4j.bolt.data; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.data.GraphPropertyContainer; 10 | 11 | import java.util.Map; 12 | 13 | public class Neo4jBoltPropertyContainer implements GraphPropertyContainer { 14 | 15 | private final Map properties; 16 | 17 | public Neo4jBoltPropertyContainer(Map properties) { 18 | this.properties = properties; 19 | } 20 | 21 | @Override 22 | public Map getProperties() { 23 | return properties; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /database/neo4j/src/main/java/com/albertoventurini/graphdbplugin/database/neo4j/bolt/data/Neo4jBoltQueryNotification.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.neo4j.bolt.data; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.query.GraphQueryNotification; 10 | 11 | public class Neo4jBoltQueryNotification implements GraphQueryNotification { 12 | 13 | private String title; 14 | private String description; 15 | private Integer positionOffset; 16 | 17 | public Neo4jBoltQueryNotification(String title, String description, Integer positionOffset) { 18 | this.title = title; 19 | this.description = description; 20 | this.positionOffset = positionOffset; 21 | } 22 | 23 | @Override 24 | public String getTitle() { 25 | return title; 26 | } 27 | 28 | @Override 29 | public String getDescription() { 30 | return description; 31 | } 32 | 33 | @Override 34 | public Integer getPositionOffset() { 35 | return positionOffset; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /database/neo4j/src/main/java/com/albertoventurini/graphdbplugin/database/neo4j/bolt/data/Neo4jGraphDatabaseVersion.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.neo4j.bolt.data; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.data.GraphDatabaseVersion; 10 | 11 | public record Neo4jGraphDatabaseVersion(int major, int minor, int patch) implements GraphDatabaseVersion { 12 | 13 | @Override 14 | public String toString() { 15 | return "Neo4j/" + major + "." + minor + "." + patch; 16 | } 17 | 18 | @Override 19 | public String idFunction() { 20 | if (major >= 5) { 21 | return "elementId"; 22 | } 23 | return "id"; 24 | } 25 | 26 | @Override 27 | public Object idToParameter(String id) { 28 | if (major >= 5) { 29 | return id; 30 | } 31 | return Long.parseLong(id); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/neo4j/src/main/java/com/albertoventurini/graphdbplugin/database/neo4j/bolt/query/Neo4jBoltQueryResultColumn.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.database.neo4j.bolt.query; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.query.GraphQueryResultColumn; 10 | 11 | public class Neo4jBoltQueryResultColumn implements GraphQueryResultColumn { 12 | 13 | private final String name; 14 | 15 | public Neo4jBoltQueryResultColumn(String name) { 16 | this.name = name; 17 | } 18 | 19 | @Override 20 | public String getName() { 21 | return name; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /database/neo4j/src/main/java/com/albertoventurini/graphdbplugin/database/neo4j/rest/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BytecodeDL/graphdb-intellij-plugin/081d805845ad0e1eba5810422ae358a8e4166974/database/neo4j/src/main/java/com/albertoventurini/graphdbplugin/database/neo4j/rest/.gitkeep -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | version=1.0.0 2 | 3 | # Intellij SDK 4 | intellijSdkVersion=2023.2 5 | 6 | # Versions 7 | versionGradleIntelliJ=1.15.0 8 | versionGradleChangelog=2.0.0 9 | versionGradleGrammarKit=2022.3.1 10 | versionJunit=4.12 11 | versionAssertj=3.23.1 12 | versionMockito=2.27.0 13 | versionPrefuse=1.0.0 14 | versionJacksonMapper=2.15.2 15 | # Official compatibility table https://neo4j.com/developer/kb/neo4j-supported-versions/ 16 | versionNeo4jJavaBoltDriver=5.11.0 17 | versionTestcontainers=1.17.6 18 | 19 | # Performance 20 | org.gradle.jvmargs=-Xmx2048m -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=7890 21 | 22 | #systemProp.socks.proxyHost=127.0.0.1 23 | #systemProp.socks.proxyPort=7890 24 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BytecodeDL/graphdb-intellij-plugin/081d805845ad0e1eba5810422ae358a8e4166974/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /graph-database-plugin/src/main/resources/META-INF/intellilang-cypher-support.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /graph-database-plugin/src/main/resources/META-INF/pluginIcon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /graph-database-plugin/src/main/resources/META-INF/pluginIcon_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /graph-database-plugin/src/main/resources/inspectionDescriptions/CypherExplainWarning.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Executes EXPLAIN query against active data source. 5 | 6 | -------------------------------------------------------------------------------- /language/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | dependencies { 5 | } 6 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/CypherIcons.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher; 8 | 9 | import icons.GraphIcons; 10 | 11 | import javax.swing.Icon; 12 | 13 | /** 14 | * @author dmitry@vrublesvky.me 15 | */ 16 | public class CypherIcons { 17 | 18 | /** 19 | * Cypher icon. 20 | */ 21 | public static final Icon FILE = GraphIcons.Language.CYPHER; 22 | } 23 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/CypherLanguage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher; 8 | 9 | import com.intellij.lang.Language; 10 | 11 | import static com.albertoventurini.graphdbplugin.platform.SupportedLanguage.CYPHER; 12 | 13 | /** 14 | * @author dmitry@vrublesvky.me 15 | */ 16 | public final class CypherLanguage extends Language { 17 | 18 | public static final CypherLanguage INSTANCE = new CypherLanguage(); 19 | 20 | private CypherLanguage() { 21 | super(CYPHER.getLanguageId()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/commenter/CypherCommenter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.commenter; 8 | 9 | import com.intellij.lang.Commenter; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | /** 13 | * Cypher commenter 14 | * 15 | * @author dmitry@vrublevsky.me 16 | */ 17 | public class CypherCommenter implements Commenter { 18 | 19 | @Nullable 20 | @Override 21 | public String getLineCommentPrefix() { 22 | return "//"; 23 | } 24 | 25 | @Nullable 26 | @Override 27 | public String getBlockCommentPrefix() { 28 | return "/*"; 29 | } 30 | 31 | @Nullable 32 | @Override 33 | public String getBlockCommentSuffix() { 34 | return "*/"; 35 | } 36 | 37 | @Nullable 38 | @Override 39 | public String getCommentedBlockCommentPrefix() { 40 | return null; 41 | } 42 | 43 | @Nullable 44 | @Override 45 | public String getCommentedBlockCommentSuffix() { 46 | return null; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/completion/metadata/atoms/CypherSimpleType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms; 8 | 9 | public enum CypherSimpleType implements CypherType { 10 | BOOLEAN, 11 | INTEGER, 12 | FLOAT, 13 | NUMBER, 14 | STRING, 15 | MAP, 16 | ANY, 17 | NULL, 18 | 19 | NODE, 20 | RELATIONSHIP, 21 | PATH 22 | } 23 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/completion/metadata/elements/CypherElement.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.elements; 8 | 9 | import com.intellij.codeInsight.lookup.LookupElement; 10 | 11 | public interface CypherElement { 12 | 13 | LookupElement getLookupElement(); 14 | } 15 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/completion/metadata/elements/CypherElementWithDocumentation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.elements; 8 | 9 | public interface CypherElementWithDocumentation { 10 | 11 | String getDocumentation(); 12 | } 13 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/completion/metadata/elements/CypherElementWithSignature.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.elements; 8 | 9 | import java.util.regex.Pattern; 10 | 11 | public interface CypherElementWithSignature { 12 | Pattern FULL_SIGNATURE_REGEXP = Pattern.compile("^(\\([^)]*\\)) :: \\(?([^)]*)\\)?$"); 13 | 14 | InvokableInformation getInvokableInformation(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/completion/metadata/elements/CypherKeywordElement.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.elements; 8 | 9 | import com.intellij.codeInsight.lookup.LookupElement; 10 | import com.intellij.codeInsight.lookup.LookupElementBuilder; 11 | 12 | public class CypherKeywordElement implements CypherElement { 13 | 14 | private final String keyword; 15 | 16 | public CypherKeywordElement(String keyword) { 17 | this.keyword = keyword; 18 | } 19 | 20 | @Override 21 | public LookupElement getLookupElement() { 22 | return LookupElementBuilder 23 | .create(keyword) 24 | .bold(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/completion/metadata/elements/CypherLabelElement.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.elements; 8 | 9 | import com.intellij.codeInsight.lookup.LookupElement; 10 | import com.intellij.codeInsight.lookup.LookupElementBuilder; 11 | import icons.GraphIcons; 12 | 13 | public class CypherLabelElement implements CypherElement { 14 | 15 | private final String label; 16 | 17 | public CypherLabelElement(String label) { 18 | this.label = label; 19 | } 20 | 21 | @Override 22 | public LookupElement getLookupElement() { 23 | return LookupElementBuilder.create(label) 24 | .withIcon(GraphIcons.Nodes.LABEL) 25 | .withTypeText("label"); 26 | } 27 | 28 | public String getName() { 29 | return label; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/completion/metadata/elements/CypherPropertyKeyElement.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.elements; 8 | 9 | import com.intellij.codeInsight.lookup.LookupElement; 10 | import com.intellij.codeInsight.lookup.LookupElementBuilder; 11 | import icons.GraphIcons; 12 | 13 | public class CypherPropertyKeyElement implements CypherElement { 14 | 15 | private final String propertyKey; 16 | 17 | public CypherPropertyKeyElement(String propertyKey) { 18 | this.propertyKey = propertyKey; 19 | } 20 | 21 | @Override 22 | public LookupElement getLookupElement() { 23 | return LookupElementBuilder.create(propertyKey) 24 | .withIcon(GraphIcons.Nodes.PROPERTY_KEY) 25 | .withTypeText("property"); 26 | } 27 | 28 | public String getName() { 29 | return propertyKey; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/completion/metadata/elements/CypherRelationshipTypeElement.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.elements; 8 | 9 | import com.intellij.codeInsight.lookup.LookupElement; 10 | import com.intellij.codeInsight.lookup.LookupElementBuilder; 11 | import icons.GraphIcons; 12 | 13 | public class CypherRelationshipTypeElement implements CypherElement { 14 | 15 | private final String relationshipType; 16 | 17 | public CypherRelationshipTypeElement(String relationshipType) { 18 | this.relationshipType = relationshipType; 19 | } 20 | 21 | @Override 22 | public LookupElement getLookupElement() { 23 | return LookupElementBuilder.create(relationshipType) 24 | .withIcon(GraphIcons.Nodes.RELATIONSHIP_TYPE) 25 | .withTypeText("relationship type"); 26 | } 27 | 28 | public String getName() { 29 | return relationshipType; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/documentation/database/CypherDocumentation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.documentation.database; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherBuiltInFunctions; 10 | 11 | public abstract class CypherDocumentation { 12 | 13 | public static final DocumentationStorage BUILT_IN_FUNCTIONS = 14 | new DocumentationStorage("built-in/functions", CypherBuiltInFunctions.FUNCTION_NAMES); 15 | } 16 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/highlight/CypherSyntaxHighlighterFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.highlight; 8 | 9 | import com.intellij.openapi.fileTypes.SyntaxHighlighter; 10 | import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory; 11 | import com.intellij.openapi.project.Project; 12 | import com.intellij.openapi.vfs.VirtualFile; 13 | import org.jetbrains.annotations.NotNull; 14 | import org.jetbrains.annotations.Nullable; 15 | 16 | /** 17 | * Syntax highlighter factory. 18 | * 19 | * @author dmitry@vrublesvky.me 20 | */ 21 | public class CypherSyntaxHighlighterFactory extends SyntaxHighlighterFactory { 22 | 23 | @NotNull 24 | @Override 25 | public SyntaxHighlighter getSyntaxHighlighter(@Nullable Project project, @Nullable VirtualFile virtualFile) { 26 | return new CypherSyntaxHighlighter(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/lang/CypherNameValidator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.lang; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherKeywords; 10 | import com.intellij.lang.refactoring.NamesValidator; 11 | import com.intellij.openapi.project.Project; 12 | import org.jetbrains.annotations.NotNull; 13 | 14 | public class CypherNameValidator implements NamesValidator { 15 | 16 | @Override 17 | public boolean isKeyword(@NotNull String name, Project project) { 18 | return CypherKeywords.KEYWORDS.contains(name.toLowerCase()); 19 | } 20 | 21 | @Override 22 | public boolean isIdentifier(@NotNull String name, Project project) { 23 | return !isKeyword(name, project) && name.matches(CypherRegexp.SYMBOLIC_NAME_REGEXP); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/lang/CypherRegexp.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.lang; 8 | 9 | /** 10 | * Regular expressions for Cypher. 11 | */ 12 | public final class CypherRegexp { 13 | 14 | public static final String SYMBOLIC_NAME_REGEXP = "(([a-zA-Z_][a-zA-Z_$0-9]*)|(`[^`]+`))"; 15 | 16 | private CypherRegexp() { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/lang/CypherSpellcheckingStrategy.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.lang; 8 | 9 | import com.intellij.psi.PsiElement; 10 | import com.intellij.spellchecker.tokenizer.SpellcheckingStrategy; 11 | import com.albertoventurini.graphdbplugin.language.cypher.CypherLanguage; 12 | import org.jetbrains.annotations.NotNull; 13 | 14 | public class CypherSpellcheckingStrategy extends SpellcheckingStrategy { 15 | 16 | @Override 17 | public boolean isMyContext(@NotNull PsiElement element) { 18 | return CypherLanguage.INSTANCE.is(element.getLanguage()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/lexer/CypherLexerAdapter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.lexer; 8 | 9 | import com.intellij.lexer.FlexAdapter; 10 | 11 | /** 12 | * TODO: Description 13 | * 14 | * @author dmitry@vrublesvky.me 15 | */ 16 | public class CypherLexerAdapter extends FlexAdapter { 17 | 18 | public CypherLexerAdapter() { 19 | super(new CypherLexer()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/CypherElementType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.psi; 8 | 9 | import com.intellij.psi.tree.IElementType; 10 | import com.albertoventurini.graphdbplugin.language.cypher.CypherLanguage; 11 | import org.jetbrains.annotations.NonNls; 12 | import org.jetbrains.annotations.NotNull; 13 | 14 | /** 15 | * TODO: Description 16 | * 17 | * @author dmitry@vrublesvky.me 18 | */ 19 | public class CypherElementType extends IElementType { 20 | 21 | public CypherElementType(@NotNull @NonNls String debugName) { 22 | super(debugName, CypherLanguage.INSTANCE); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/impl/CypherAllFunctionInvocationImplMixin.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.language.cypher.psi.impl; 2 | 3 | import com.albertoventurini.graphdbplugin.language.cypher.psi.CypherAllFunctionInvocation; 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class CypherAllFunctionInvocationImplMixin 9 | extends ASTWrapperPsiElement implements CypherAllFunctionInvocation { 10 | 11 | public CypherAllFunctionInvocationImplMixin(@NotNull ASTNode node) { 12 | super(node); 13 | } 14 | 15 | @Override 16 | public String getFullName() { 17 | return "all"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/impl/CypherAnyFunctionInvocationImplMixin.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.language.cypher.psi.impl; 2 | 3 | import com.albertoventurini.graphdbplugin.language.cypher.psi.CypherAnyFunctionInvocation; 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class CypherAnyFunctionInvocationImplMixin 9 | extends ASTWrapperPsiElement implements CypherAnyFunctionInvocation { 10 | 11 | public CypherAnyFunctionInvocationImplMixin(@NotNull ASTNode node) { 12 | super(node); 13 | } 14 | 15 | @Override 16 | public String getFullName() { 17 | return "any"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/impl/CypherExistsFunctionInvocationImplMixin.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.language.cypher.psi.impl; 2 | 3 | import com.albertoventurini.graphdbplugin.language.cypher.psi.CypherExistsFunctionInvocation; 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class CypherExistsFunctionInvocationImplMixin 9 | extends ASTWrapperPsiElement implements CypherExistsFunctionInvocation { 10 | 11 | public CypherExistsFunctionInvocationImplMixin(@NotNull ASTNode node) { 12 | super(node); 13 | } 14 | 15 | @Override 16 | public String getFullName() { 17 | return "exists"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/impl/CypherExtractFunctionInvocationImplMixin.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.language.cypher.psi.impl; 2 | 3 | import com.albertoventurini.graphdbplugin.language.cypher.psi.CypherExtractFunctionInvocation; 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class CypherExtractFunctionInvocationImplMixin 9 | extends ASTWrapperPsiElement implements CypherExtractFunctionInvocation { 10 | 11 | public CypherExtractFunctionInvocationImplMixin(@NotNull ASTNode node) { 12 | super(node); 13 | } 14 | 15 | @Override 16 | public String getFullName() { 17 | return "extract"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/impl/CypherFilterFunctionInvocationImplMixin.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.language.cypher.psi.impl; 2 | 3 | import com.albertoventurini.graphdbplugin.language.cypher.psi.CypherFilterFunctionInvocation; 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class CypherFilterFunctionInvocationImplMixin 9 | extends ASTWrapperPsiElement implements CypherFilterFunctionInvocation { 10 | 11 | public CypherFilterFunctionInvocationImplMixin(@NotNull ASTNode node) { 12 | super(node); 13 | } 14 | 15 | @Override 16 | public String getFullName() { 17 | return "filter"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/impl/CypherFunctionInvocationImplMixin.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.language.cypher.psi.impl; 2 | 3 | import com.albertoventurini.graphdbplugin.language.cypher.psi.CypherFunctionInvocation; 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class CypherFunctionInvocationImplMixin 9 | extends ASTWrapperPsiElement implements CypherFunctionInvocation { 10 | 11 | public CypherFunctionInvocationImplMixin(@NotNull final ASTNode node) { 12 | super(node); 13 | } 14 | 15 | @Override 16 | public String getFullName() { 17 | return this.getFunctionInvocationBody().getText(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/impl/CypherNoneFunctionInvocationImplMixin.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.language.cypher.psi.impl; 2 | 3 | import com.albertoventurini.graphdbplugin.language.cypher.psi.CypherNoneFunctionInvocation; 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class CypherNoneFunctionInvocationImplMixin 9 | extends ASTWrapperPsiElement implements CypherNoneFunctionInvocation { 10 | 11 | public CypherNoneFunctionInvocationImplMixin(@NotNull ASTNode node) { 12 | super(node); 13 | } 14 | 15 | @Override 16 | public String getFullName() { 17 | return "none"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/impl/CypherProcedureInvocationImplMixin.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.language.cypher.psi.impl; 2 | 3 | import com.albertoventurini.graphdbplugin.language.cypher.psi.CypherProcedureInvocation; 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class CypherProcedureInvocationImplMixin 9 | extends ASTWrapperPsiElement implements CypherProcedureInvocation { 10 | 11 | public CypherProcedureInvocationImplMixin(@NotNull final ASTNode node) { 12 | super(node); 13 | } 14 | 15 | @Override 16 | public String getFullName() { 17 | return this.getProcedureInvocationBody().getText(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/impl/CypherReduceFunctionInvocationImplMixin.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.language.cypher.psi.impl; 2 | 3 | import com.albertoventurini.graphdbplugin.language.cypher.psi.CypherReduceFunctionInvocation; 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class CypherReduceFunctionInvocationImplMixin 9 | extends ASTWrapperPsiElement implements CypherReduceFunctionInvocation { 10 | 11 | public CypherReduceFunctionInvocationImplMixin(@NotNull ASTNode node) { 12 | super(node); 13 | } 14 | 15 | @Override 16 | public String getFullName() { 17 | return "reduce"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/psi/impl/CypherSingleFunctionInvocationImplMixin.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.language.cypher.psi.impl; 2 | 3 | import com.albertoventurini.graphdbplugin.language.cypher.psi.CypherSingleFunctionInvocation; 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class CypherSingleFunctionInvocationImplMixin 9 | extends ASTWrapperPsiElement implements CypherSingleFunctionInvocation { 10 | 11 | public CypherSingleFunctionInvocationImplMixin(@NotNull ASTNode node) { 12 | super(node); 13 | } 14 | 15 | @Override 16 | public String getFullName() { 17 | return "single"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/CypherArgumentList.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references; 8 | 9 | import com.intellij.psi.PsiElement; 10 | 11 | public interface CypherArgumentList extends PsiElement { 12 | } 13 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/CypherNamedElement.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references; 8 | 9 | import com.intellij.psi.PsiNameIdentifierOwner; 10 | 11 | /** 12 | * @author dmitry@vrublevsky.me 13 | */ 14 | public interface CypherNamedElement extends PsiNameIdentifierOwner { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/CypherNamedElementImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references; 8 | 9 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 10 | import com.intellij.lang.ASTNode; 11 | import com.intellij.psi.ContributedReferenceHost; 12 | import org.jetbrains.annotations.NotNull; 13 | 14 | /** 15 | * TODO: Description 16 | * 17 | * @author dmitry@vrublevsky.me 18 | */ 19 | public abstract class CypherNamedElementImpl extends ASTWrapperPsiElement 20 | implements CypherNamedElement, ContributedReferenceHost { 21 | 22 | public CypherNamedElementImpl(@NotNull ASTNode node) { 23 | super(node); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/CypherReferenceContributionPriority.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references; 8 | 9 | /** 10 | * Cypher specific priorities. 11 | * 12 | * @author dmitry@vrublevsky.me 13 | */ 14 | public enum CypherReferenceContributionPriority { 15 | VARIABLE(200.0), 16 | LABEL_NAME(180.0), 17 | REL_TYPE_NAME(180.0), 18 | PROPERTY_KEY_NAME(170.0); 19 | 20 | private final double priority; 21 | 22 | CypherReferenceContributionPriority(double priority) { 23 | this.priority = priority; 24 | } 25 | 26 | public double getPriority() { 27 | return priority; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/CypherVariableElementImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references; 8 | 9 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 10 | import com.intellij.lang.ASTNode; 11 | import com.intellij.psi.ContributedReferenceHost; 12 | import org.jetbrains.annotations.NotNull; 13 | 14 | public abstract class CypherVariableElementImpl extends ASTWrapperPsiElement 15 | implements CypherVariableElement, ContributedReferenceHost { 16 | 17 | public CypherVariableElementImpl(@NotNull ASTNode node) { 18 | super(node); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherAnyYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 10 | 11 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.ANY; 12 | 13 | public interface CypherAnyYielding extends CypherTyped { 14 | 15 | @Override 16 | default CypherType getType() { 17 | return ANY; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherBooleanYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 10 | 11 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.BOOLEAN; 12 | 13 | public interface CypherBooleanYielding extends CypherTyped { 14 | 15 | @Override 16 | default CypherType getType() { 17 | return BOOLEAN; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherFloatYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 10 | 11 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.FLOAT; 12 | 13 | public interface CypherFloatYielding extends CypherTyped { 14 | 15 | @Override 16 | default CypherType getType() { 17 | return FLOAT; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherIntegerYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 10 | 11 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.INTEGER; 12 | 13 | public interface CypherIntegerYielding extends CypherTyped { 14 | 15 | @Override 16 | default CypherType getType() { 17 | return INTEGER; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherListYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherList; 10 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 11 | 12 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.ANY; 13 | 14 | public interface CypherListYielding extends CypherTyped { 15 | 16 | @Override 17 | default CypherType getType() { 18 | return CypherList.of(ANY); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherMapYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 10 | 11 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.MAP; 12 | 13 | public interface CypherMapYielding extends CypherTyped { 14 | 15 | @Override 16 | default CypherType getType() { 17 | return MAP; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherNodeYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 10 | 11 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.NODE; 12 | 13 | public interface CypherNodeYielding extends CypherTyped { 14 | 15 | @Override 16 | default CypherType getType() { 17 | return NODE; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherNullYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 10 | 11 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.NULL; 12 | 13 | public interface CypherNullYielding extends CypherTyped { 14 | 15 | @Override 16 | default CypherType getType() { 17 | return NULL; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherPathYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 10 | 11 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.PATH; 12 | 13 | public interface CypherPathYielding extends CypherTyped { 14 | 15 | @Override 16 | default CypherType getType() { 17 | return PATH; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherRelationshipYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 10 | 11 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.RELATIONSHIP; 12 | 13 | public interface CypherRelationshipYielding extends CypherTyped { 14 | 15 | @Override 16 | default CypherType getType() { 17 | return RELATIONSHIP; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherStringYielding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 10 | 11 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.STRING; 12 | 13 | public interface CypherStringYielding extends CypherTyped { 14 | 15 | @Override 16 | default CypherType getType() { 17 | return STRING; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherTypePropagator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.intellij.psi.PsiElement; 10 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 11 | 12 | import static com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherSimpleType.ANY; 13 | 14 | public interface CypherTypePropagator extends CypherTyped { 15 | 16 | @Override 17 | default CypherType getType() { 18 | PsiElement[] children = getChildren(); 19 | if (children.length != 1) { 20 | return ANY; 21 | } 22 | 23 | PsiElement child = children[0]; 24 | if (child instanceof CypherTyped) { 25 | return ((CypherTyped) child).getType(); 26 | } 27 | return ANY; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/references/types/CypherTyped.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.references.types; 8 | 9 | import com.intellij.psi.PsiElement; 10 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherType; 11 | 12 | public interface CypherTyped extends PsiElement { 13 | 14 | CypherType getType(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/util/FileTypeExtensionUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.util; 8 | 9 | import java.util.Arrays; 10 | import java.util.List; 11 | 12 | public class FileTypeExtensionUtil { 13 | 14 | public static final List EXTENSIONS = Arrays.asList("cyp", "cql", "cypher"); 15 | 16 | public static boolean isCypherFileTypeExtension(String extension) { 17 | return extension != null && EXTENSIONS.contains(extension); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /language/cypher/src/main/java/com/albertoventurini/graphdbplugin/language/cypher/util/PsiUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.util; 8 | 9 | import com.intellij.openapi.util.TextRange; 10 | import com.intellij.psi.PsiElement; 11 | 12 | /** 13 | * TODO: Description 14 | * 15 | * @author dmitry@vrublevsky.me 16 | */ 17 | public final class PsiUtil { 18 | 19 | private PsiUtil() { 20 | } 21 | 22 | public static TextRange rangeFrom(PsiElement element) { 23 | return new TextRange(0, element.getText().length()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /language/cypher/src/main/resources/com/albertoventurini/graphdbplugin/language/cypher/documentation/database/built-in/functions/allShortestPaths.html: -------------------------------------------------------------------------------- 1 | function allShortestPaths(pattern)
2 |
3 | Finds all the shortest paths between two nodes.
4 |
5 | Example Query: 6 |
 7 |     MATCH (martin:Person { name:"Martin Sheen" }),(michael:Person { name:"Michael Douglas" }), p = allShortestPaths((martin)-[*]-(michael))
 8 |     RETURN p
 9 | 
10 | -------------------------------------------------------------------------------- /language/cypher/src/main/resources/com/albertoventurini/graphdbplugin/language/cypher/documentation/database/built-in/functions/coalesce.html: -------------------------------------------------------------------------------- 1 | function coalesce(expression [, expression]*)
2 |
3 | Returns the first non-NULL value in the list of expressions passed to it. In case all arguments are NULL, NULL will be returned.
4 |
5 | Arguments: 6 |
7 | expression: The expression that might return NULL.
8 |
9 |
10 | Example Query: 11 |
12 |     MATCH (a)
13 |     WHERE a.name='Alice'
14 |     RETURN coalesce(a.hairColor, a.eyes)
15 | 
16 | -------------------------------------------------------------------------------- /language/cypher/src/main/resources/com/albertoventurini/graphdbplugin/language/cypher/documentation/database/built-in/functions/shortestPath.html: -------------------------------------------------------------------------------- 1 | function shortestPath(pattern)
2 |
3 | Find shortest path between two nodes
4 |
5 | Example Query: 6 |
 7 |     MATCH (martin:Person { name:"Martin Sheen" }),(oliver:Person { name:"Oliver Stone" }), p = shortestPath((martin)-[*..15]-(oliver))
 8 |     RETURN p
 9 | 
10 | -------------------------------------------------------------------------------- /language/cypher/src/main/resources/com/albertoventurini/graphdbplugin/language/cypher/documentation/database/built-in/functions/timestamp.html: -------------------------------------------------------------------------------- 1 | function timestamp()
2 |
3 | timestamp() returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. 4 | It will return the same value during the whole one query, even if the query is a long running one.
5 |
6 |
7 | Example Query: 8 |
 9 |     RETURN timestamp()
10 | 
11 | -------------------------------------------------------------------------------- /language/cypher/src/main/resources/inspectionDescriptions/CypherFunctionCall.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This inspection checks function and procedure calls. 4 | 5 | 6 | -------------------------------------------------------------------------------- /language/cypher/src/test/java/com/albertoventurini/graphdbplugin/language/cypher/documentation/database/CypherDocumentationTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher.documentation.database; 8 | 9 | import org.junit.Test; 10 | 11 | public class CypherDocumentationTest { 12 | 13 | @Test 14 | public void testBuiltInFunctionsLoadsCorrectly() { 15 | CypherDocumentation.BUILT_IN_FUNCTIONS.lookup("toString"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /platform/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | apply plugin: "org.jetbrains.intellij" 5 | 6 | intellij { 7 | version = intellijSdkVersion 8 | instrumentCode = true 9 | } 10 | 11 | dependencies { 12 | } 13 | -------------------------------------------------------------------------------- /platform/src/main/java/com/albertoventurini/graphdbplugin/platform/GraphBundle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.platform; 8 | 9 | import com.intellij.AbstractBundle; 10 | import org.jetbrains.annotations.PropertyKey; 11 | 12 | import java.util.ResourceBundle; 13 | 14 | public class GraphBundle { 15 | 16 | private static final String BUNDLE_NAME = "graphdb.messages.GraphBundle"; 17 | 18 | private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); 19 | 20 | public static String message(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) { 21 | return AbstractBundle.message(BUNDLE, key, params); 22 | } 23 | 24 | public static String messageOrDefault(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, String defaultValue, 25 | Object... params) { 26 | return AbstractBundle.messageOrDefault(BUNDLE, key, defaultValue, params); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /platform/src/main/java/com/albertoventurini/graphdbplugin/platform/GraphConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.platform; 8 | 9 | public final class GraphConstants { 10 | 11 | public static final boolean IS_DEVELOPMENT = System.getProperty("graphDatabaseSupportDevelopment") != null; 12 | 13 | public static final String BOUND_DATA_SOURCE_PREFIX = "graphdbBoundDataSource-"; 14 | public static final String PLUGIN_ID = "com.albertoventurini.jetbrains.graphdbplugin"; 15 | 16 | public static class ToolWindow { 17 | public static final String CONSOLE_TOOL_WINDOW = "Graph Database Console"; 18 | 19 | public static class Tabs { 20 | public static final String LOG = "Log"; 21 | public static final String GRAPH = "Graph"; 22 | public static final String TABLE = "Table"; 23 | public static final String PARAMETERS = "Parameters"; 24 | } 25 | } 26 | 27 | public static class Actions { 28 | public static final String CONSOLE_ACTIONS = "GraphDatabaseConsoleToolWindowActions"; 29 | } 30 | 31 | private GraphConstants() { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /platform/src/main/java/com/albertoventurini/graphdbplugin/platform/ShouldNeverHappenException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.platform; 8 | 9 | public class ShouldNeverHappenException extends RuntimeException { 10 | 11 | public ShouldNeverHappenException(String developer, String reason) { 12 | super(developer + " claims that " + reason + "should never happen"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /platform/src/main/java/com/albertoventurini/graphdbplugin/platform/SupportedLanguage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.platform; 8 | 9 | import java.util.stream.Stream; 10 | 11 | import static com.google.common.base.Preconditions.checkNotNull; 12 | 13 | public enum SupportedLanguage { 14 | CYPHER("Cypher"); 15 | 16 | private final String languageId; 17 | 18 | SupportedLanguage(String languageId) { 19 | this.languageId = languageId; 20 | } 21 | 22 | public String getLanguageId() { 23 | return languageId; 24 | } 25 | 26 | public static boolean isSupported(String languageId) { 27 | checkNotNull(languageId, "'languageId' is undefined"); 28 | return Stream.of(values()) 29 | .anyMatch(language -> language.getLanguageId().equals(languageId)); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /platform/src/main/resources/graphdb/messages/GraphBundle.properties: -------------------------------------------------------------------------------- 1 | updater.title=Graph Database plugin updated to v{0} 2 | updater.notification=\ 3 | Support IntelliJ 2023.2 4 | -------------------------------------------------------------------------------- /platform/src/test/java/com/albertoventurini/graphdbplugin/language/cypher/SupportedLanguageTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.language.cypher; 8 | 9 | import com.albertoventurini.graphdbplugin.platform.SupportedLanguage; 10 | import org.junit.Test; 11 | 12 | import static org.junit.Assert.assertFalse; 13 | import static org.junit.Assert.assertTrue; 14 | 15 | public class SupportedLanguageTest { 16 | 17 | @Test 18 | public void languageSupported() { 19 | assertTrue(SupportedLanguage.isSupported(SupportedLanguage.CYPHER.getLanguageId())); 20 | } 21 | 22 | @Test 23 | public void languageUnsupported() { 24 | assertFalse(SupportedLanguage.isSupported("Java")); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /release-and-publish.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ "$TRAVIS_SECURE_ENV_VARS" = false ]; then 3 | echo "Will not release and publish, no credentials. Maybe you are trying to publish from a fork?"; 4 | exit 0; 5 | fi 6 | ./gradlew buildPlugin 7 | ./gradlew :graph-database-plugin:publishPlugin -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | // Languages 2 | include 'language' 3 | include 'language:cypher' 4 | 5 | // Database adaptors 6 | include 'database' 7 | include 'database:api' 8 | include 'database:neo4j' 9 | 10 | // UI 11 | include 'ui' 12 | include 'ui:visualization' 13 | include 'ui:jetbrains' 14 | 15 | // Plugin 16 | include 'graph-database-plugin' 17 | include 'platform' 18 | 19 | // Testing 20 | include 'testing' 21 | include 'testing:common' 22 | include 'testing:manual' 23 | include 'testing:database' 24 | include 'testing:integration-neo4j' 25 | 26 | -------------------------------------------------------------------------------- /testing/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | dependencies { 5 | } 6 | -------------------------------------------------------------------------------- /testing/common/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "org.jetbrains.intellij" 2 | 3 | intellij { 4 | version = intellijSdkVersion 5 | plugins = ['java'] 6 | } 7 | 8 | dependencies { 9 | implementation project(':graph-database-plugin') 10 | implementation project(':ui:jetbrains') 11 | } -------------------------------------------------------------------------------- /testing/common/src/main/java/com/albertoventurini/graphdbplugin/test/mocks/service/DummyExecutorService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.mocks.service; 8 | 9 | import com.albertoventurini.graphdbplugin.jetbrains.services.ExecutorService; 10 | import com.intellij.openapi.application.ModalityState; 11 | 12 | import java.util.concurrent.Callable; 13 | import java.util.function.Consumer; 14 | 15 | public class DummyExecutorService implements ExecutorService { 16 | 17 | @Override 18 | public void runInBackground(Callable task, Consumer onSuccess, Consumer onFailure) { 19 | try { 20 | T result = task.call(); 21 | onSuccess.accept(result); 22 | } catch (Exception e) { 23 | onFailure.accept(e); 24 | } 25 | } 26 | 27 | @Override 28 | public void runInBackground(Callable task, Consumer onSuccess, Consumer onFailure, ModalityState modalityState) { 29 | runInBackground(task, onSuccess, onFailure); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /testing/integration-neo4j/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | apply plugin: "org.jetbrains.intellij" 5 | 6 | intellij { 7 | version = intellijSdkVersion 8 | plugins = ['java'] 9 | } 10 | 11 | dependencies { 12 | testImplementation project(':graph-database-plugin') 13 | testImplementation project(':ui:jetbrains') 14 | testImplementation project(':language:cypher') 15 | testImplementation project(':database:api') 16 | testImplementation project(':database:neo4j') 17 | testImplementation project(':testing:common') 18 | testImplementation project(':platform') 19 | testImplementation "org.assertj:assertj-core:$versionAssertj" 20 | testImplementation "org.mockito:mockito-core:$versionMockito" 21 | testImplementation "org.neo4j.driver:neo4j-java-driver:$versionNeo4jJavaBoltDriver" 22 | testImplementation "org.testcontainers:testcontainers:$versionTestcontainers" 23 | testImplementation "org.testcontainers:neo4j:$versionTestcontainers" 24 | } 25 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/completion/KeywordsCompletionTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.completion; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.atoms.CypherKeywords; 10 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseCompletionTest; 11 | import com.intellij.codeInsight.completion.CompletionType; 12 | 13 | 14 | import java.util.List; 15 | 16 | import static org.assertj.core.api.Assertions.assertThat; 17 | 18 | public class KeywordsCompletionTest extends BaseCompletionTest { 19 | 20 | public void testKeywords() throws Exception { 21 | myFixture.configureByText("test.cyp", ""); 22 | myFixture.complete(CompletionType.BASIC); 23 | List strings = myFixture.getLookupElementStrings(); 24 | assertThat(strings) 25 | .containsAll(CypherKeywords.KEYWORDS); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/editor/BraceMatcherTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.editor; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseGenericTest; 10 | 11 | public class BraceMatcherTest extends BaseGenericTest { 12 | 13 | public void testCloseParentheses() throws Exception { 14 | myFixture.configureByText("test.cyp", "MATCH "); 15 | myFixture.type("("); 16 | myFixture.checkResult("MATCH ()"); 17 | } 18 | 19 | public void testCloseSquare() throws Exception { 20 | myFixture.configureByText("test.cyp", "RETURN "); 21 | myFixture.type("["); 22 | myFixture.checkResult("RETURN []"); 23 | } 24 | 25 | public void testCloseCurly() throws Exception { 26 | myFixture.configureByText("test.cyp", "RETURN "); 27 | myFixture.type("{"); 28 | myFixture.checkResult("RETURN {}"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/parsing/CommandParsingTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.parsing; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseParsingTest; 10 | 11 | public class CommandParsingTest extends BaseParsingTest { 12 | 13 | public CommandParsingTest() { 14 | super("command"); 15 | } 16 | 17 | public void testConstraintPropertyExistsNodeCreate() { 18 | doTest(true); 19 | } 20 | 21 | public void testConstraintPropertyExistsNodeDrop() { 22 | doTest(true); 23 | } 24 | 25 | public void testConstraintPropertyExistsRelCreate() { 26 | doTest(true); 27 | } 28 | 29 | public void testConstraintPropertyExistsRelDrop() { 30 | doTest(true); 31 | } 32 | 33 | public void testConstraintPropertyUniqueCreate() { 34 | doTest(true); 35 | } 36 | 37 | public void testConstraintPropertyUniqueDrop() { 38 | doTest(true); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/parsing/CommentsParsingTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.parsing; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseParsingTest; 10 | 11 | public class CommentsParsingTest extends BaseParsingTest { 12 | 13 | public CommentsParsingTest() { 14 | super("comments"); 15 | } 16 | 17 | public void testBlock() { 18 | doTest(true); 19 | } 20 | 21 | public void testLine() { 22 | doTest(true); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/parsing/IndexCommandParsingTest.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.parsing; 2 | 3 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseParsingTest; 4 | 5 | public class IndexCommandParsingTest extends BaseParsingTest { 6 | 7 | public IndexCommandParsingTest() { 8 | super("indexes"); 9 | } 10 | 11 | public void testCreateNamedIndex() { 12 | doTest(true); 13 | } 14 | 15 | public void testCreateUnnamedIndex() { 16 | doTest(true); 17 | } 18 | 19 | public void testCreateIndexOnRelationships() { 20 | doTest(true); 21 | } 22 | 23 | public void testCreateIndexWithOptions() { 24 | doTest(true); 25 | } 26 | 27 | public void testCreateIndexIfNotExists() { 28 | doTest(true); 29 | } 30 | 31 | public void testCreateRangeIndex() { 32 | doTest(true); 33 | } 34 | 35 | public void testCreateLookupIndex() { 36 | doTest(true); 37 | } 38 | 39 | public void testCreatePointIndex() { 40 | doTest(true); 41 | } 42 | 43 | public void testCreateTextIndex() { 44 | doTest(true); 45 | } 46 | 47 | public void testDropIndex() { 48 | doTest(true); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/parsing/LexerTest.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.parsing; 2 | 3 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseParsingTest; 4 | 5 | public class LexerTest extends BaseParsingTest { 6 | 7 | public LexerTest() { 8 | super("lexer"); 9 | } 10 | 11 | public void testScientificNotation() { 12 | doTest(true); 13 | } 14 | 15 | public void testHexNumbers() { 16 | doTest(true); 17 | } 18 | 19 | public void testOctalNumbers() { 20 | doTest(true); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/parsing/PatternsParsingTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.parsing; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseParsingTest; 10 | 11 | public class PatternsParsingTest extends BaseParsingTest { 12 | 13 | public PatternsParsingTest() { 14 | super("patterns"); 15 | } 16 | 17 | public void testPatterns() { 18 | doTest(true); 19 | } 20 | 21 | public void testWhereInsidePatterns() { 22 | doTest(true); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/parsing/QueryParsingTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.parsing; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseParsingTest; 10 | 11 | public class QueryParsingTest extends BaseParsingTest { 12 | 13 | public QueryParsingTest() { 14 | super("query"); 15 | } 16 | 17 | public void testMultipleQueries() { 18 | doTest(true); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/parsing/ShellParsingTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.parsing; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseParsingTest; 10 | 11 | public class ShellParsingTest extends BaseParsingTest { 12 | 13 | public ShellParsingTest() { 14 | super("shell"); 15 | } 16 | 17 | public void testKeywords() { 18 | doTest(true); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/parsing/StatementOptionsParsingTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.parsing; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseParsingTest; 10 | 11 | public class StatementOptionsParsingTest extends BaseParsingTest { 12 | 13 | public StatementOptionsParsingTest() { 14 | super("statement-options"); 15 | } 16 | 17 | public void testStatementOptions() { 18 | doTest(true); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/reference/LabelReferenceContributorTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.reference; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseCompletionTest; 10 | 11 | public class LabelReferenceContributorTest extends BaseCompletionTest { 12 | 13 | public void testPresentInCompletion() throws Exception { 14 | myFixture.configureByText("test.cyp", "MATCH (n:TestLabel) RETURN n; MATCH (n:Test"); 15 | myFixture.completeBasic(); 16 | myFixture.checkResult("MATCH (n:TestLabel) RETURN n; MATCH (n:TestLabel"); 17 | } 18 | 19 | public void _testOneEntryPresentInCompletionIfMetadataExists() throws Exception { 20 | addLabel("TestLabel"); 21 | myFixture.configureByText("test.cyp", "MATCH (n:TestLabel) RETURN n; MATCH (n:Test"); 22 | myFixture.completeBasic(); 23 | myFixture.checkResult("MATCH (n:TestLabel) RETURN n; MATCH (n:TestLabel"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/reference/PropertyReferenceContributorTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.reference; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseCompletionTest; 10 | 11 | public class PropertyReferenceContributorTest extends BaseCompletionTest { 12 | 13 | public void testPresentInCompletion() throws Exception { 14 | myFixture.configureByText("test.cyp", "MATCH (n) WHERE n.testProperty = 1 RETURN n.testProp"); 15 | myFixture.completeBasic(); 16 | myFixture.checkResult("MATCH (n) WHERE n.testProperty = 1 RETURN n.testProperty"); 17 | } 18 | 19 | public void _testOneEntryPresentInCompletionIfMetadataExists() throws Exception { 20 | addProperty("testProperty"); 21 | myFixture.configureByText("test.cyp", "MATCH (n) WHERE n.testProperty = 1 RETURN n.testProp"); 22 | myFixture.completeBasic(); 23 | myFixture.checkResult("MATCH (n) WHERE n.testProperty = 1 RETURN n.testProperty"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/reference/RelationshipTypeReferenceContributorTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.reference; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseCompletionTest; 10 | 11 | public class RelationshipTypeReferenceContributorTest extends BaseCompletionTest { 12 | 13 | public void testPresentInCompletion() throws Exception { 14 | myFixture.configureByText("test.cyp", "MATCH ()-[:TESTRELTYPE]-() MATCH ()-[:TESTREL"); 15 | myFixture.completeBasic(); 16 | myFixture.checkResult("MATCH ()-[:TESTRELTYPE]-() MATCH ()-[:TESTRELTYPE"); 17 | } 18 | 19 | public void _testOneEntryPresentInCompletionIfMetadataExists() throws Exception { 20 | addRelationshipType("TESTRELTYPE"); 21 | myFixture.configureByText("test.cyp", "MATCH ()-[:TESTRELTYPE]-() MATCH ()-[:TESTREL"); 22 | myFixture.completeBasic(); 23 | myFixture.checkResult("MATCH ()-[:TESTRELTYPE]-() MATCH ()-[:TESTRELTYPE"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/rename/LabelRenameTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.rename; 8 | 9 | 10 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseRenameTest; 11 | 12 | public class LabelRenameTest extends BaseRenameTest { 13 | 14 | public LabelRenameTest() { 15 | super("label"); 16 | } 17 | 18 | public void testSingleQuery() { 19 | verify("RENAMED_LABEL"); 20 | } 21 | 22 | public void testMultipleQueries() { 23 | verify("RENAMED_LABEL"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/rename/PropertyRenameTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.rename; 8 | 9 | 10 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseRenameTest; 11 | 12 | public class PropertyRenameTest extends BaseRenameTest { 13 | 14 | public PropertyRenameTest() { 15 | super("property"); 16 | } 17 | 18 | public void testSingleQuery() { 19 | verify("renamedProperty"); 20 | } 21 | 22 | public void testMultipleQueries() { 23 | verify("renamedProperty"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/rename/RelationshipTypeRenameTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.rename; 8 | 9 | 10 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseRenameTest; 11 | 12 | public class RelationshipTypeRenameTest extends BaseRenameTest { 13 | 14 | public RelationshipTypeRenameTest() { 15 | super("relationship_type"); 16 | } 17 | 18 | public void testSingleQuery() { 19 | verify("RENAMED_TYPE"); 20 | } 21 | 22 | public void testMultipleQueries() { 23 | verify("RENAMED_TYPE"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/rename/VariableRenameTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.rename; 8 | 9 | 10 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util.BaseRenameTest; 11 | 12 | public class VariableRenameTest extends BaseRenameTest { 13 | 14 | public VariableRenameTest() { 15 | super("variable"); 16 | } 17 | 18 | public void testSingleQuery() { 19 | verify("renamed"); 20 | } 21 | 22 | public void testMultipleQueries() { 23 | verify("renamed"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/util/BaseCodeInsightTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util; 8 | 9 | import com.google.common.io.Resources; 10 | import org.jetbrains.annotations.NotNull; 11 | 12 | abstract class BaseCodeInsightTest extends BaseGenericTest { 13 | 14 | private String namespace; 15 | private final String dataPath; 16 | 17 | public BaseCodeInsightTest(String namespace, String dataPath) { 18 | this.namespace = namespace; 19 | this.dataPath = dataPath; 20 | } 21 | 22 | @Override 23 | protected String getTestDataPath() { 24 | return Resources.getResource(namespace).getFile() + "/" + dataPath; 25 | } 26 | 27 | @NotNull 28 | protected String getTestName() { 29 | return getTestName(false); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/util/BaseCompletionTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.completion.metadata.CypherMetadataContainer; 10 | 11 | public abstract class BaseCompletionTest extends BaseGenericTest { 12 | 13 | protected CypherMetadataContainer metadata; 14 | 15 | @Override 16 | public void setUp() throws Exception { 17 | super.setUp(); 18 | metadata = services().cypherMetadataProvider().getContainer("documentationTest"); 19 | } 20 | 21 | public void addStoredProcedure(String name, String signature, String description) { 22 | metadata.addProcedure(name, signature, description); 23 | } 24 | 25 | public void addLabel(String name) { 26 | metadata.addLabel(name); 27 | } 28 | 29 | public void addRelationshipType(String name) { 30 | metadata.addRelationshipType(name); 31 | } 32 | 33 | public void addProperty(String name) { 34 | metadata.addPropertyKey(name); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/util/BaseGenericTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util; 8 | 9 | import com.albertoventurini.graphdbplugin.test.integration.neo4j.util.base.BaseIntegrationTest; 10 | 11 | public abstract class BaseGenericTest extends BaseIntegrationTest { 12 | } 13 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/util/BaseParsingTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util; 8 | 9 | import com.albertoventurini.graphdbplugin.language.cypher.CypherParserDefinition; 10 | import com.google.common.io.Resources; 11 | import com.intellij.testFramework.ParsingTestCase; 12 | 13 | 14 | /** 15 | * Base for all parsing test cases. 16 | */ 17 | public abstract class BaseParsingTest extends ParsingTestCase { 18 | 19 | public BaseParsingTest(String testDataFolder) { 20 | super(testDataFolder, "cyp", new CypherParserDefinition()); 21 | } 22 | 23 | @Override 24 | protected String getTestDataPath() { 25 | return Resources.getResource("parsing").getFile(); 26 | } 27 | 28 | @Override 29 | protected boolean skipSpaces() { 30 | return true; 31 | } 32 | 33 | @Override 34 | protected boolean includeRanges() { 35 | return true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/tests/cypher/util/BaseRenameTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.tests.cypher.util; 8 | 9 | public abstract class BaseRenameTest extends BaseCodeInsightTest { 10 | 11 | public BaseRenameTest(String dataPath) { 12 | super("rename", dataPath); 13 | } 14 | 15 | protected void verify(String newName) { 16 | myFixture.configureByFiles(getTestName() + ".cyp"); 17 | myFixture.renameElementAtCaret(newName); 18 | myFixture.checkResultByFile(getTestName() + "After.cyp"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/util/server/Neo4jContainerServers.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.util.server; 2 | 3 | /** 4 | * Lazily-initialised versions of Neo4j running in test containers. 5 | */ 6 | public enum Neo4jContainerServers { 7 | VERSION_5_2("5.2"), 8 | VERSION_5_3("5.3"); 9 | 10 | private volatile Neo4jContainerServer instance; 11 | private final String versionTag; 12 | 13 | /** 14 | * Get the {@link Neo4jServer} instance for this version of Neo4j. 15 | * The instance is lazily initialised when this method is invoked for the first time. 16 | * @return a lazily-initialised {@link Neo4jServer} instance 17 | */ 18 | public Neo4jServer getInstance() { 19 | if (instance == null) { 20 | synchronized (this) { 21 | if (instance == null) { 22 | instance = new Neo4jContainerServer(versionTag); 23 | instance.start(); 24 | } 25 | } 26 | } 27 | return instance; 28 | } 29 | 30 | Neo4jContainerServers(final String versionTag) { 31 | this.versionTag = versionTag; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/util/server/Neo4jServer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.util.server; 8 | 9 | public interface Neo4jServer { 10 | 11 | String getBoltHost(); 12 | 13 | String getBoltPort(); 14 | } 15 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/java/com/albertoventurini/graphdbplugin/test/integration/neo4j/util/server/Startable.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.test.integration.neo4j.util.server; 2 | 3 | /** 4 | * Represents a resource that can be started. 5 | */ 6 | public interface Startable { 7 | 8 | /** Start the resource. */ 9 | void start(); 10 | } 11 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/command/ConstraintPropertyExistsNodeCreate.cyp: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT ON (var:Label) ASSERT exists(p.property); 2 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/command/ConstraintPropertyExistsNodeDrop.cyp: -------------------------------------------------------------------------------- 1 | DROP CONSTRAINT ON (var:Label) ASSERT exists(p.property); 2 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/command/ConstraintPropertyExistsRelCreate.cyp: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT ON ()-[r:LIKED]-() ASSERT exists(r.prop); 2 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/command/ConstraintPropertyExistsRelDrop.cyp: -------------------------------------------------------------------------------- 1 | DROP CONSTRAINT ON ()-[r:LIKED]-() ASSERT exists(r.prop); 2 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/command/ConstraintPropertyUniqueCreate.cyp: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT ON (var:Label) ASSERT var.prop IS UNIQUE; 2 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/command/ConstraintPropertyUniqueDrop.cyp: -------------------------------------------------------------------------------- 1 | DROP CONSTRAINT ON (var:Label) ASSERT var.prop IS UNIQUE; 2 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/comments/Block.cyp: -------------------------------------------------------------------------------- 1 | /* RETURN 1; */ 2 | RETURN 1; 3 | RETURN /* RETURN 2 */ 3; 4 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/comments/Line.cyp: -------------------------------------------------------------------------------- 1 | // comment1 2 | RETURN 3 | // comment2 4 | 1; 5 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/comments/Line.txt: -------------------------------------------------------------------------------- 1 | Cypher file: FILE(0,33) 2 | PsiComment(LINE_COMMENT)('// comment1')(0,11) 3 | CypherStatementItemImpl(STATEMENT_ITEM)(12,33) 4 | CypherStatementImpl(STATEMENT)(12,32) 5 | CypherQueryOptionsImpl(QUERY_OPTIONS)(12,12) 6 | 7 | CypherQueryImpl(QUERY)(12,32) 8 | CypherRegularQueryImpl(REGULAR_QUERY)(12,32) 9 | CypherSingleQueryImpl(SINGLE_QUERY)(12,32) 10 | CypherSinglePartQueryImpl(SINGLE_PART_QUERY)(12,32) 11 | CypherReadingWithReturnImpl(READING_WITH_RETURN)(12,32) 12 | CypherReturnImpl(RETURN)(12,32) 13 | PsiElement(RETURN)('RETURN')(12,18) 14 | PsiComment(LINE_COMMENT)('// comment2')(19,30) 15 | CypherReturnBodyImpl(RETURN_BODY)(31,32) 16 | CypherReturnItemsImpl(RETURN_ITEMS)(31,32) 17 | CypherReturnItemImpl(RETURN_ITEM)(31,32) 18 | CypherExpressionImpl(EXPRESSION)(31,32) 19 | CypherNumberLiteralImpl(NUMBER_LITERAL)(31,32) 20 | CypherIntegerLiteralImpl(INTEGER_LITERAL)(31,32) 21 | CypherUnsignedIntegerImpl(UNSIGNED_INTEGER)(31,32) 22 | PsiElement(integer)('1')(31,32) 23 | PsiElement(;)(';')(32,33) -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/expressions/CountFunction.cyp: -------------------------------------------------------------------------------- 1 | RETURN COUNT(*) -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/expressions/CountFunction.txt: -------------------------------------------------------------------------------- 1 | Cypher file: FILE(0,15) 2 | CypherStatementItemImpl(STATEMENT_ITEM)(0,15) 3 | CypherStatementImpl(STATEMENT)(0,15) 4 | CypherQueryOptionsImpl(QUERY_OPTIONS)(0,0) 5 | 6 | CypherQueryImpl(QUERY)(0,15) 7 | CypherRegularQueryImpl(REGULAR_QUERY)(0,15) 8 | CypherSingleQueryImpl(SINGLE_QUERY)(0,15) 9 | CypherSinglePartQueryImpl(SINGLE_PART_QUERY)(0,15) 10 | CypherReadingWithReturnImpl(READING_WITH_RETURN)(0,15) 11 | CypherReturnImpl(RETURN)(0,15) 12 | PsiElement(RETURN)('RETURN')(0,6) 13 | CypherReturnBodyImpl(RETURN_BODY)(7,15) 14 | CypherReturnItemsImpl(RETURN_ITEMS)(7,15) 15 | CypherReturnItemImpl(RETURN_ITEM)(7,15) 16 | CypherExpressionImpl(EXPRESSION)(7,15) 17 | CypherCountStarImpl(COUNT_STAR)(7,15) 18 | PsiElement(COUNT)('COUNT')(7,12) 19 | PsiElement(()('(')(12,13) 20 | PsiElement(*)('*')(13,14) 21 | PsiElement())(')')(14,15) -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/expressions/Expressions.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n) 2 | WITH n 3 | OR n 4 | XOR n 5 | AND n 6 | AND NOT n 7 | AND var = 1 8 | AND var <> 1 9 | AND var != 1 10 | AND var < 1 11 | AND var > 1 12 | AND var <= 1 13 | AND var >= 1 14 | AND var - var 15 | AND var + var 16 | AND var * var 17 | AND var / var 18 | AND var % var 19 | AND var ^ var 20 | AND [var] 21 | AND var [var..var] 22 | AND var [..] 23 | AND var [var..] 24 | AND var [..var] 25 | AND var =~ "s" 26 | AND var IN [1, 2] 27 | AND var STARTS WITH "1" 28 | AND var ENDS WITH "2" 29 | AND var CONTAINS "3" 30 | AND var IS NULL 31 | AND var IS NOT NULL 32 | AND var.prop 33 | AND var:Label 34 | AND 1 35 | AND "2" 36 | AND true 37 | AND false 38 | AND null 39 | AND CASE var WHEN expr THEN expr END 40 | AND CASE WHEN expr THEN expr END 41 | AND CASE WHEN expr THEN expr END 42 | AND var.prop.prop.prop 43 | AND {key: "val"} 44 | AND {key: "val", key: "val"} 45 | AND [var IN expr] 46 | AND [var in expr | expr ] 47 | AND [] 48 | AND [expr] 49 | AND [expr, expr] 50 | AND (n)-[]-() 51 | AND (expr) 52 | AND func() 53 | AND func() -1 54 | AND func() - 1 55 | AND func() --1 56 | AND func(-1) 57 | AND func(1) 58 | AND func(var) 59 | AND func(var, var) 60 | AND func(DISTINCT var) 61 | AND func(DISTINCT var, var) 62 | AND var 63 | AND 1.2 64 | AND 1 65 | AND -1.2 66 | AND -1 67 | AND 'str' 68 | AND "str" 69 | AND "str \n" 70 | AND "str \"" 71 | RETURN n -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/expressions/KeywordInIdentifier.cyp: -------------------------------------------------------------------------------- 1 | MATCH (match) RETURN match; 2 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/expressions/MapProjection.cyp: -------------------------------------------------------------------------------- 1 | RETURN var{ 2 | .varProperty, 3 | someVar, 4 | .*, 5 | someLiteral: 2 6 | }; 7 | 8 | RETURN var{}; 9 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/expressions/Parameters.cyp: -------------------------------------------------------------------------------- 1 | RETURN {param}; 2 | RETURN {`param`}; 3 | RETURN $param; 4 | RETURN $`param`; 5 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/expressions/PatternComprehension.cyp: -------------------------------------------------------------------------------- 1 | RETURN [(n)-[]-() | n.property]; 2 | RETURN [(n)-[]-() WHERE n.property = 2 | n.property]; 3 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/expressions/SpecialFunctions.cyp: -------------------------------------------------------------------------------- 1 | RETURN filter(var IN expr) 2 | AND filter(var IN expr WHERE expr) 3 | AND extract(var IN expr) 4 | AND extract(var IN expr | expr) 5 | AND reduce(var = expr, var IN expr | expr) 6 | AND all(var IN expr) 7 | AND any(var IN expr) 8 | AND none(var IN expr) 9 | AND single(var in expr) 10 | AND exists(expr) 11 | AND shortestpath((n)) 12 | AND allshortestpaths((n)); 13 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/expressions/UserFunction.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n) RETURN com.example.addFoo(n) 2 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/indexes/CreateIndexIfNotExists.cyp: -------------------------------------------------------------------------------- 1 | CREATE INDEX node_range_index_name IF NOT EXISTS FOR (n:Person) ON (n.surname); -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/indexes/CreateIndexOnRelationships.cyp: -------------------------------------------------------------------------------- 1 | CREATE INDEX rel_range_index_name FOR ()-[r:KNOWS]- ( ) ON (r.since); -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/indexes/CreateIndexWithOptions.cyp: -------------------------------------------------------------------------------- 1 | CREATE INDEX index_with_config 2 | FOR (n:Label) ON (n.prop2) 3 | OPTIONS { 4 | indexConfig: { 5 | `spatial.cartesian.min`: [-100.0, -100.0], 6 | `spatial.cartesian.max`: [100.0, 100.0], 7 | anotherOption: "a string value" 8 | } 9 | } -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/indexes/CreateLookupIndex.cyp: -------------------------------------------------------------------------------- 1 | CREATE LOOKUP INDEX node_label_lookup_index FOR (n) ON EACH labels(n); 2 | CREATE LOOKUP INDEX rel_type_lookup_index FOR ()-[r]-( ) ON type(r); -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/indexes/CreateNamedIndex.cyp: -------------------------------------------------------------------------------- 1 | CREATE INDEX node_range_index_name FOR (n:Person) ON (n.surname); -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/indexes/CreatePointIndex.cyp: -------------------------------------------------------------------------------- 1 | CREATE POINT INDEX node_range_index_name FOR (n:Person) ON (n.surname); -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/indexes/CreateRangeIndex.cyp: -------------------------------------------------------------------------------- 1 | CREATE RANGE INDEX node_range_index_name FOR (n:Person) ON (n.surname); -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/indexes/CreateTextIndex.cyp: -------------------------------------------------------------------------------- 1 | CREATE TEXT INDEX node_range_index_name FOR (n:Person) ON (n.surname); -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/indexes/CreateUnnamedIndex.cyp: -------------------------------------------------------------------------------- 1 | CREATE INDEX FOR (n:Person) ON (n.surname); -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/indexes/DropIndex.cyp: -------------------------------------------------------------------------------- 1 | DROP INDEX node_range_index_name; 2 | DROP INDEX node_range_index_name IF EXISTS; 3 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/lexer/HexNumbers.cyp: -------------------------------------------------------------------------------- 1 | RETURN 0x10 -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/lexer/HexNumbers.txt: -------------------------------------------------------------------------------- 1 | Cypher file: FILE(0,11) 2 | CypherStatementItemImpl(STATEMENT_ITEM)(0,11) 3 | CypherStatementImpl(STATEMENT)(0,11) 4 | CypherQueryOptionsImpl(QUERY_OPTIONS)(0,0) 5 | 6 | CypherQueryImpl(QUERY)(0,11) 7 | CypherRegularQueryImpl(REGULAR_QUERY)(0,11) 8 | CypherSingleQueryImpl(SINGLE_QUERY)(0,11) 9 | CypherSinglePartQueryImpl(SINGLE_PART_QUERY)(0,11) 10 | CypherReadingWithReturnImpl(READING_WITH_RETURN)(0,11) 11 | CypherReturnImpl(RETURN)(0,11) 12 | PsiElement(RETURN)('RETURN')(0,6) 13 | CypherReturnBodyImpl(RETURN_BODY)(7,11) 14 | CypherReturnItemsImpl(RETURN_ITEMS)(7,11) 15 | CypherReturnItemImpl(RETURN_ITEM)(7,11) 16 | CypherExpressionImpl(EXPRESSION)(7,11) 17 | CypherNumberLiteralImpl(NUMBER_LITERAL)(7,11) 18 | CypherIntegerLiteralImpl(INTEGER_LITERAL)(7,11) 19 | CypherUnsignedIntegerImpl(UNSIGNED_INTEGER)(7,11) 20 | PsiElement(hex_integer)('0x10')(7,11) -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/lexer/OctalNumbers.cyp: -------------------------------------------------------------------------------- 1 | RETURN 0o01234567 -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/lexer/OctalNumbers.txt: -------------------------------------------------------------------------------- 1 | Cypher file: FILE(0,17) 2 | CypherStatementItemImpl(STATEMENT_ITEM)(0,17) 3 | CypherStatementImpl(STATEMENT)(0,17) 4 | CypherQueryOptionsImpl(QUERY_OPTIONS)(0,0) 5 | 6 | CypherQueryImpl(QUERY)(0,17) 7 | CypherRegularQueryImpl(REGULAR_QUERY)(0,17) 8 | CypherSingleQueryImpl(SINGLE_QUERY)(0,17) 9 | CypherSinglePartQueryImpl(SINGLE_PART_QUERY)(0,17) 10 | CypherReadingWithReturnImpl(READING_WITH_RETURN)(0,17) 11 | CypherReturnImpl(RETURN)(0,17) 12 | PsiElement(RETURN)('RETURN')(0,6) 13 | CypherReturnBodyImpl(RETURN_BODY)(7,17) 14 | CypherReturnItemsImpl(RETURN_ITEMS)(7,17) 15 | CypherReturnItemImpl(RETURN_ITEM)(7,17) 16 | CypherExpressionImpl(EXPRESSION)(7,17) 17 | CypherNumberLiteralImpl(NUMBER_LITERAL)(7,17) 18 | CypherIntegerLiteralImpl(INTEGER_LITERAL)(7,17) 19 | CypherUnsignedIntegerImpl(UNSIGNED_INTEGER)(7,17) 20 | PsiElement(octal_integer)('0o01234567')(7,17) -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/lexer/ScientificNotation.cyp: -------------------------------------------------------------------------------- 1 | RETURN 1e6; 2 | RETURN 1.7976931348623157e+308; -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/patterns/Patterns.cyp: -------------------------------------------------------------------------------- 1 | MATCH () 2 | MATCH (n); 3 | MATCH (n), (n); 4 | MATCH p=(n); 5 | MATCH (n), p=(n); 6 | MATCH SHORTESTPATH((n)); 7 | MATCH ALLSHORTESTPATHS((n)); 8 | MATCH (n:Label) 9 | MATCH (n {param}) 10 | MATCH (n {key: "value"}) 11 | MATCH (n {key: "value", key: "value"}) 12 | MATCH (n)--(n); 13 | MATCH (n)<--(n); 14 | MATCH (n)-->(n); 15 | MATCH (n)<-->(n); 16 | MATCH (n)-[]-(n); 17 | MATCH (n)-[var]-(n); 18 | MATCH (n)-[var:Type]-(n); 19 | MATCH (n)-[var:Type]-(n); 20 | MATCH (n)-[var?]-(n); 21 | MATCH (n)-[var?:Type]-(n); 22 | MATCH (n)-[var:Type|:Type]-(n); 23 | MATCH (n)-[var:Type|Type]-(n); 24 | MATCH (n)-[var:Type*]-(n); 25 | MATCH (n)-[var:Type*..]-(n); 26 | MATCH (n)-[var:Type*2..]-(n); 27 | MATCH (n)-[var:Type*..2]-(n); 28 | MATCH (n)-[var:Type*2..2]-(n); 29 | MATCH (n)-[var {param}]-(n); 30 | MATCH (n)-[var {key: "value"}]-(n); 31 | MATCH (n)-[var {key: "value", key: "value"}]-(n); 32 | MATCH (n) - [:Type] -> (m) 33 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/patterns/WhereInsidePatterns.cyp: -------------------------------------------------------------------------------- 1 | WITH 30 AS minAge 2 | MATCH (a:Person WHERE a.name = 'Andy')-[:KNOWS]->(b:Person {city: "Somewhere"} WHERE b.age > minAge) 3 | RETURN b.name; 4 | MATCH (a:Person)-[r:KNOWS WHERE r.since < 2023]->(b:Person) 5 | RETURN r.since; -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/MultipleQueries.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n) RETURN n; 2 | MATCH (m) RETURN m; 3 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Call.cyp: -------------------------------------------------------------------------------- 1 | CALL fun(1, 2); 2 | CALL space.fun(1, 2); 3 | CALL space.fun(); 4 | CALL space.fun() YIELD var; 5 | CALL space.fun() YIELD expr as var; 6 | CALL space.fun() YIELD var, var; 7 | CALL dbms.procedures() YIELD name, signature 8 | WHERE name='dbms.listConfig' 9 | RETURN signature; 10 | CALL db.propertyKeys() YIELD propertyKey AS prop 11 | MATCH (n) 12 | WHERE n[prop] IS NOT NULL RETURN prop, count(n) AS numNodes; -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Create.cyp: -------------------------------------------------------------------------------- 1 | CREATE UNIQUE (n); 2 | CREATE (n); 3 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Delete.cyp: -------------------------------------------------------------------------------- 1 | DELETE n; 2 | DETACH DELETE n; 3 | DELETE n, m; 4 | DETACH DELETE n, m; 5 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Foreach.cyp: -------------------------------------------------------------------------------- 1 | FOREACH (var IN list | CREATE (n)); 2 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/LoadCSV.cyp: -------------------------------------------------------------------------------- 1 | LOAD CSV WITH HEADERS FROM "url" AS var FIELDTERMINATOR "," RETURN *; 2 | LOAD CSV FROM "url" AS var FIELDTERMINATOR ","; 3 | LOAD CSV FROM "url" AS var; 4 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Match.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n) RETURN (n); 2 | OPTIONAL MATCH (n) RETURN (n); 3 | MATCH (n) USING INDEX var:Label(prop) RETURN (n); 4 | MATCH (n) USING JOIN ON var RETURN (n); 5 | MATCH (n) USING JOIN ON var, var RETURN (n); 6 | MATCH (n) USING SCAN var:Label RETURN (n); 7 | MATCH (n) WHERE n.prop = 1 RETURN (n); 8 | MATCH p = ((head:Topic)<-[:FOLLOWS*]-(t:Topic)) 9 | WHERE NOT (head)-[:FOLLOWS]->(:Topic) 10 | RETURN nodes(p), length(p) 11 | ORDER BY length(p) DESC 12 | LIMIT 1 RETURN (p); -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Merge.cyp: -------------------------------------------------------------------------------- 1 | MERGE (n); 2 | MERGE (n) ON MATCH SET n.prop = 1; 3 | MERGE (n) ON CREATE SET n.prop = 1; 4 | MERGE (n) ON MATCH SET n.prop = 1 ON CREATE SET n.prop = 1; 5 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Remove.cyp: -------------------------------------------------------------------------------- 1 | REMOVE var:Label; 2 | REMOVE var:Label:Label; 3 | REMOVE var.prop; 4 | REMOVE var.prop, var:Label, var:Label:Label; 5 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Return.cyp: -------------------------------------------------------------------------------- 1 | RETURN *; 2 | RETURN DISTINCT *; 3 | RETURN *, expr as var, expr; 4 | RETURN * ORDER BY var; 5 | RETURN * ORDER BY var, var; 6 | RETURN * ORDER BY var ASC; 7 | RETURN * ORDER BY var ASCENDING; 8 | RETURN * ORDER BY var DESC; 9 | RETURN * ORDER BY var DESCENDING; 10 | RETURN * SKIP expr; 11 | RETURN * LIMIT expr; 12 | RETURN * ORDER BY var SKIP expr LIMIT expr; 13 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Set.cyp: -------------------------------------------------------------------------------- 1 | SET var.prop = 1; 2 | SET var = 1; 3 | SET var += 1; 4 | SET var:Label; 5 | SET var:Label:Label; 6 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Start.cyp: -------------------------------------------------------------------------------- 1 | START var=node(*),var=node(*) RETURN *; 2 | START var=node:Label(prop="string") RETURN *; 3 | START var=node:Label(prop={param}) RETURN *; 4 | START var=node:Label("string") RETURN *; 5 | START var=node:Label({param}) RETURN *; 6 | START var=node(1) RETURN *; 7 | START var=node(1, 2) RETURN *; 8 | START var=node({param}) RETURN *; 9 | START var=node(*) RETURN *; 10 | START var=rel:Label(prop="string") RETURN *; 11 | START var=rel:Label(prop={param}) RETURN *; 12 | START var=rel:Label("string") RETURN *; 13 | START var=rel:Label({param}) RETURN *; 14 | START var=rel(1) RETURN *; 15 | START var=rel(1, 2) RETURN *; 16 | START var=rel({param}) RETURN *; 17 | START var=rel(*) RETURN *; 18 | START var=relationship:Label(prop="string") RETURN *; 19 | START var=relationship:Label(prop={param}) RETURN *; 20 | START var=relationship:Label("string") RETURN *; 21 | START var=relationship:Label({param}) RETURN *; 22 | START var=relationship(1) RETURN *; 23 | START var=relationship(1, 2) RETURN *; 24 | START var=relationship({param}) RETURN *; 25 | START var=relationship(*) RETURN *; 26 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/SubQueries.cyp: -------------------------------------------------------------------------------- 1 | CALL { 2 | RETURN "Hello" AS msg 3 | } 4 | RETURN msg; 5 | CALL { 6 | WITH xs 7 | UNWIND xs AS x 8 | MATCH (n:Node {name: x}) 9 | RETURN n.name AS name 10 | } 11 | RETURN name; 12 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/SubQueriesInTransactions.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n:Label) WHERE n.prop > 100 2 | CALL { 3 | WITH n 4 | DETACH DELETE n 5 | } IN TRANSACTIONS 6 | RETURN msg; 7 | CALL { 8 | WITH line 9 | CREATE (:Person {name: line[1], age: toInteger(line[2])}) 10 | } IN TRANSACTIONS OF 2 ROWS 11 | RETURN msg -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Union.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n) RETURN n UNION ALL MATCH (n) RETURN n; 2 | MATCH (n) RETURN n UNION MATCH (n) RETURN n; 3 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/Unwind.cyp: -------------------------------------------------------------------------------- 1 | UNWIND expr AS var RETURN *; 2 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/query/clause/With.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n) WITH * RETURN *; 2 | MATCH (n) WITH DISTINCT * RETURN *; 3 | MATCH (n) WITH *, expr as var, expr RETURN *; 4 | MATCH (n) WITH * ORDER BY var RETURN *; 5 | MATCH (n) WITH * ORDER BY var, var RETURN *; 6 | MATCH (n) WITH * ORDER BY var ASC RETURN *; 7 | MATCH (n) WITH * ORDER BY var ASCENDING RETURN *; 8 | MATCH (n) WITH * ORDER BY var DESC RETURN *; 9 | MATCH (n) WITH * ORDER BY var DESCENDING RETURN *; 10 | MATCH (n) WITH * SKIP expr RETURN *; 11 | MATCH (n) WITH * LIMIT expr RETURN *; 12 | MATCH (n) WITH * ORDER BY var SKIP expr LIMIT expr RETURN *; 13 | MATCH (n) WITH * WHERE n = 1 RETURN *; 14 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/shell/Keywords.cyp: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | COMMIT; 3 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/shell/Keywords.txt: -------------------------------------------------------------------------------- 1 | Cypher file: FILE(0,14) 2 | CypherStatementItemImpl(STATEMENT_ITEM)(0,6) 3 | CypherStatementImpl(STATEMENT)(0,5) 4 | PsiElement(BEGIN)('BEGIN')(0,5) 5 | PsiElement(;)(';')(5,6) 6 | CypherStatementItemImpl(STATEMENT_ITEM)(7,14) 7 | CypherStatementImpl(STATEMENT)(7,13) 8 | PsiElement(COMMIT)('COMMIT')(7,13) 9 | PsiElement(;)(';')(13,14) 10 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/parsing/statement-options/StatementOptions.cyp: -------------------------------------------------------------------------------- 1 | CYPHER RETURN n; 2 | CYPHER 2.3 RETURN n; 3 | CYPHER key=val RETURN n; 4 | CYPHER key1=val1 key2=val2 RETURN n; 5 | CYPHER 2.3 key=val RETURN n; 6 | CYPHER 2.3 key1=val2 key2=val2 RETURN n; 7 | EXPLAIN RETURN n; 8 | PROFILE RETURN n; 9 | CYPHER 2.3 key1=val2 key2=val2 EXPLAIN PROFILE RETURN n; 10 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/label/MultipleQueries.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n:RENAME_THIS) 2 | MATCH (m:RENAME_THIS) 3 | RETURN *; 4 | 5 | MATCH (n:RENAME_THIS) 6 | MATCH (m:RENAME_THIS) 7 | RETURN *; 8 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/label/MultipleQueriesAfter.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n:RENAMED_LABEL) 2 | MATCH (m:RENAMED_LABEL) 3 | RETURN *; 4 | 5 | MATCH (n:RENAMED_LABEL) 6 | MATCH (m:RENAMED_LABEL) 7 | RETURN *; 8 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/label/SingleQuery.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n:RENAME_THIS) 2 | MATCH (m:RENAME_THIS) 3 | RETURN *; 4 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/label/SingleQueryAfter.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n:RENAMED_LABEL) 2 | MATCH (m:RENAMED_LABEL) 3 | RETURN *; 4 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/property/MultipleQueries.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n) 2 | WHERE n.renameThis = 'test' 3 | RETURN n.renameThis; 4 | 5 | MATCH (n) 6 | WHERE n.renameThis = 'test' 7 | RETURN n.renameThis; 8 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/property/MultipleQueriesAfter.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n) 2 | WHERE n.renamedProperty = 'test' 3 | RETURN n.renamedProperty; 4 | 5 | MATCH (n) 6 | WHERE n.renamedProperty = 'test' 7 | RETURN n.renamedProperty; 8 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/property/SingleQuery.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n) 2 | WHERE n.renameThis = 'test' 3 | RETURN n.renameThis; 4 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/property/SingleQueryAfter.cyp: -------------------------------------------------------------------------------- 1 | MATCH (n) 2 | WHERE n.renamedProperty = 'test' 3 | RETURN n.renamedProperty; 4 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/relationship_type/MultipleQueries.cyp: -------------------------------------------------------------------------------- 1 | MATCH ()-[:RENAME_THIS]-() 2 | MATCH ()-[:RENAME_THIS]-() 3 | RETURN *; 4 | 5 | MATCH ()-[:RENAME_THIS]-() 6 | MATCH ()-[:RENAME_THIS]-() 7 | RETURN *; 8 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/relationship_type/MultipleQueriesAfter.cyp: -------------------------------------------------------------------------------- 1 | MATCH ()-[:RENAMED_TYPE]-() 2 | MATCH ()-[:RENAMED_TYPE]-() 3 | RETURN *; 4 | 5 | MATCH ()-[:RENAMED_TYPE]-() 6 | MATCH ()-[:RENAMED_TYPE]-() 7 | RETURN *; 8 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/relationship_type/SingleQuery.cyp: -------------------------------------------------------------------------------- 1 | MATCH ()-[:RENAME_THIS]-() 2 | MATCH ()-[:RENAME_THIS]-() 3 | RETURN *; 4 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/relationship_type/SingleQueryAfter.cyp: -------------------------------------------------------------------------------- 1 | MATCH ()-[:RENAMED_TYPE]-() 2 | MATCH ()-[:RENAMED_TYPE]-() 3 | RETURN *; 4 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/variable/MultipleQueries.cyp: -------------------------------------------------------------------------------- 1 | MATCH (renameThis) 2 | RETURN (renameThis); 3 | 4 | MATCH (renameThis) 5 | RETURN (renameThis); 6 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/variable/MultipleQueriesAfter.cyp: -------------------------------------------------------------------------------- 1 | MATCH (renameThis) 2 | RETURN (renameThis); 3 | 4 | MATCH (renamed) 5 | RETURN (renamed); 6 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/variable/SingleQuery.cyp: -------------------------------------------------------------------------------- 1 | MATCH (renameThis) 2 | RETURN (renameThis); 3 | -------------------------------------------------------------------------------- /testing/integration-neo4j/src/test/resources/rename/variable/SingleQueryAfter.cyp: -------------------------------------------------------------------------------- 1 | MATCH (renamed) 2 | RETURN (renamed); 3 | -------------------------------------------------------------------------------- /testing/manual/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | apply plugin: "org.jetbrains.intellij" 5 | 6 | intellij { 7 | version = intellijSdkVersion 8 | plugins = ['java'] 9 | } 10 | 11 | dependencies { 12 | implementation project(':ui:jetbrains') 13 | implementation project(':ui:visualization') 14 | implementation project(':database:api') 15 | implementation project(':database:neo4j') 16 | implementation "de.sciss:prefuse-core:$versionPrefuse" 17 | } 18 | 19 | -------------------------------------------------------------------------------- /ui/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | dependencies { 5 | } 6 | -------------------------------------------------------------------------------- /ui/jetbrains/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | apply plugin: "org.jetbrains.intellij" 5 | 6 | intellij { 7 | version = intellijSdkVersion 8 | instrumentCode = true 9 | plugins = ['java'] 10 | } 11 | 12 | dependencies { 13 | implementation project(":platform") 14 | 15 | implementation project(':language:cypher') 16 | 17 | implementation project(':database:neo4j') 18 | implementation project(':database:api') 19 | 20 | implementation "org.neo4j.driver:neo4j-java-driver:$versionNeo4jJavaBoltDriver" 21 | 22 | implementation project(':ui:visualization') 23 | 24 | implementation "de.sciss:prefuse-core:$versionPrefuse" 25 | 26 | implementation("com.fasterxml.jackson.core:jackson-core:$versionJacksonMapper") 27 | implementation("com.fasterxml.jackson.core:jackson-databind:$versionJacksonMapper") 28 | 29 | testImplementation "junit:junit:$versionJunit" 30 | testImplementation "org.assertj:assertj-core:$versionAssertj" 31 | testImplementation "org.mockito:mockito-core:$versionMockito" 32 | } 33 | 34 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/actions/execute/ExecuteQueryEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.actions.execute; 8 | 9 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state.DataSourceApi; 10 | import com.intellij.util.messages.Topic; 11 | 12 | public interface ExecuteQueryEvent { 13 | 14 | Topic EXECUTE_QUERY_TOPIC = Topic.create("GraphDatabase.ExecuteQueryTopic", ExecuteQueryEvent.class); 15 | 16 | void executeQuery(DataSourceApi dataSource, ExecuteQueryPayload payload); 17 | } 18 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/actions/execute/ExplainQueryAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.actions.execute; 8 | 9 | public class ExplainQueryAction extends ExecuteQueryAction { 10 | 11 | @Override 12 | protected String decorateQuery(String query) { 13 | return "EXPLAIN " + super.decorateQuery(query); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/actions/execute/LandingPageAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.actions.execute; 8 | 9 | import com.intellij.icons.AllIcons; 10 | import com.intellij.ide.browsers.BrowserLauncher; 11 | import com.intellij.openapi.ui.Messages; 12 | 13 | import java.awt.*; 14 | import java.net.URI; 15 | 16 | public class LandingPageAction { 17 | public static final String URL = "https://technologies.neueda.com/plugin"; 18 | 19 | public static void open() { 20 | int ok = Messages.showOkCancelDialog("This feature is planned for a \nfuture release of the premium version.\n" + 21 | "If you are interested, please visit: \n\n" + URL, "Premium Version", "Find more", "Cancel", 22 | AllIcons.General.QuestionDialog); 23 | if (ok == 0) { 24 | try { 25 | Desktop.getDesktop().browse(URI.create(URL)); 26 | } catch (Exception e) { 27 | BrowserLauncher.getInstance().browse(URI.create(URL)); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/actions/execute/ProfileQueryAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.actions.execute; 8 | 9 | public class ProfileQueryAction extends ExecuteQueryAction { 10 | 11 | @Override 12 | protected String decorateQuery(String query) { 13 | return "PROFILE " + super.decorateQuery(query); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/actions/ui/console/CleanCanvasAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.actions.ui.console; 8 | 9 | import com.intellij.openapi.actionSystem.AnAction; 10 | import com.intellij.openapi.actionSystem.AnActionEvent; 11 | import com.intellij.openapi.project.Project; 12 | import com.intellij.util.messages.MessageBus; 13 | 14 | public class CleanCanvasAction extends AnAction { 15 | 16 | @Override 17 | public void actionPerformed(AnActionEvent e) { 18 | Project project = getEventProject(e); 19 | 20 | if (project == null) { 21 | return; 22 | } 23 | 24 | MessageBus messageBus = project.getMessageBus(); 25 | messageBus.syncPublisher(CleanCanvasEvent.CLEAN_CANVAS_TOPIC).cleanCanvas(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/actions/ui/console/CleanCanvasEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.actions.ui.console; 8 | 9 | import com.intellij.util.messages.Topic; 10 | 11 | public interface CleanCanvasEvent { 12 | 13 | Topic CLEAN_CANVAS_TOPIC = Topic.create("GraphDatabaseConsole.CleanCanvasTopic", CleanCanvasEvent.class); 14 | 15 | void cleanCanvas(); 16 | } 17 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/actions/ui/console/CopyQueryOutputAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.actions.ui.console; 8 | 9 | import com.intellij.openapi.actionSystem.AnAction; 10 | import com.intellij.openapi.actionSystem.AnActionEvent; 11 | import com.intellij.openapi.project.Project; 12 | import com.intellij.util.messages.MessageBus; 13 | import com.albertoventurini.graphdbplugin.jetbrains.ui.console.event.CopyQueryOutputEvent; 14 | import org.jetbrains.annotations.NotNull; 15 | 16 | public class CopyQueryOutputAction extends AnAction { 17 | 18 | @Override 19 | public void actionPerformed(@NotNull AnActionEvent e) { 20 | Project project = getEventProject(e); 21 | 22 | if (project == null) { 23 | return; 24 | } 25 | 26 | MessageBus messageBus = project.getMessageBus(); 27 | messageBus.syncPublisher(CopyQueryOutputEvent.COPY_QUERY_OUTPUT_TOPIC).copyQueryOutputToClipboard(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/actions/ui/console/ToggleFileSpecificParametersEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.actions.ui.console; 8 | 9 | import com.intellij.util.messages.Topic; 10 | 11 | public interface ToggleFileSpecificParametersEvent { 12 | 13 | Topic TOGGLE_FILE_SPECIFIC_PARAMETERS_EVENT_TOPIC = 14 | Topic.create("GraphDatabaseConsole.ToggleFileSpecificParametersTopic", 15 | ToggleFileSpecificParametersEvent.class); 16 | 17 | void toggle(boolean setToUseFileSpecificParams); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/DataSourceDescription.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource; 8 | 9 | import icons.GraphIcons; 10 | 11 | import javax.swing.Icon; 12 | 13 | public interface DataSourceDescription { 14 | 15 | DataSourceType getType(); 16 | 17 | String geTypeName(); 18 | 19 | Icon getIcon(); 20 | 21 | String getDefaultFileExtension(); 22 | 23 | DataSourceDescription NEO4J_BOLT = new DataSourceDescription() { 24 | @Override 25 | public DataSourceType getType() { 26 | return DataSourceType.NEO4J_BOLT; 27 | } 28 | 29 | @Override 30 | public Icon getIcon() { 31 | return GraphIcons.Database.NEO4J; 32 | } 33 | 34 | @Override 35 | public String getDefaultFileExtension() { 36 | return "cypher"; 37 | } 38 | 39 | @Override 40 | public String geTypeName() { 41 | return "Neo4j - Bolt"; 42 | } 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/DataSourceType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource; 8 | 9 | public enum DataSourceType { 10 | UNKNOWN, NEO4J_BOLT 11 | } 12 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/metadata/DataSourceMetadata.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata; 8 | 9 | public interface DataSourceMetadata { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/metadata/MetadataBuilder.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata; 2 | 3 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state.DataSourceApi; 4 | 5 | public interface MetadataBuilder { 6 | DataSourceMetadata buildMetadata(DataSourceApi dataSource); 7 | } 8 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/metadata/neo4j/Neo4jConstraintMetadata.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata.neo4j; 2 | 3 | public record Neo4jConstraintMetadata(String name) { 4 | } 5 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/metadata/neo4j/Neo4jFunctionMetadata.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata.neo4j; 2 | 3 | public record Neo4jFunctionMetadata(String name, String signature, String description) { 4 | } 5 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/metadata/neo4j/Neo4jIndexMetadata.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata.neo4j; 2 | 3 | public record Neo4jIndexMetadata( 4 | String name, 5 | String state) { } -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/metadata/neo4j/Neo4jLabelMetadata.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata.neo4j; 2 | 3 | public record Neo4jLabelMetadata(String name, long count) { 4 | } 5 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/metadata/neo4j/Neo4jMetadata.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata.neo4j; 2 | 3 | import com.albertoventurini.graphdbplugin.database.api.data.GraphDatabaseVersion; 4 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata.DataSourceMetadata; 5 | 6 | import java.util.*; 7 | 8 | public record Neo4jMetadata( 9 | GraphDatabaseVersion version, 10 | List functions, 11 | List procedures, 12 | List constraints, 13 | List labels, 14 | List relationshipTypes, 15 | List indexes, 16 | List propertyKeys) 17 | implements DataSourceMetadata { } 18 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/metadata/neo4j/Neo4jProcedureMetadata.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata.neo4j; 2 | 3 | public record Neo4jProcedureMetadata(String name, String signature, String description) { 4 | } 5 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/metadata/neo4j/Neo4jRelationshipTypeMetadata.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata.neo4j; 2 | 3 | public record Neo4jRelationshipTypeMetadata(String name, long count) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/datasource/state/DataSourceApi.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state; 8 | 9 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.DataSourceDescription; 10 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.DataSourceType; 11 | 12 | import java.util.Map; 13 | 14 | public interface DataSourceApi { 15 | 16 | String getUUID(); 17 | 18 | String getName(); 19 | 20 | DataSourceType getDataSourceType(); 21 | 22 | Map getConfiguration(); 23 | 24 | default DataSourceDescription getDescription() { 25 | if (getDataSourceType() == DataSourceType.NEO4J_BOLT) { 26 | return DataSourceDescription.NEO4J_BOLT; 27 | } 28 | throw new IllegalStateException("Unknown data source type encountered: " + getDataSourceType()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/highlighter/QueryHighlighterComponent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.component.highlighter; 8 | 9 | public interface QueryHighlighterComponent { 10 | } 11 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/component/settings/SettingsComponent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.component.settings; 8 | 9 | import com.intellij.openapi.application.ApplicationManager; 10 | 11 | /** 12 | * This service allows persisting and reading configuration settings. 13 | */ 14 | public interface SettingsComponent { 15 | 16 | static SettingsComponent getInstance() { 17 | return ApplicationManager.getApplication().getService(SettingsComponent.class); 18 | } 19 | 20 | boolean isGraphViewZoomInverted(); 21 | 22 | void invertGraphViewZoom(boolean state); 23 | 24 | String getKnownPluginVersion(); 25 | 26 | void setKnownPluginVersion(String version); 27 | } 28 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/database/DatabaseManagerService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.database; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.GraphDatabaseApi; 10 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state.DataSourceApi; 11 | 12 | public interface DatabaseManagerService { 13 | 14 | GraphDatabaseApi getDatabaseFor(DataSourceApi dataSource); 15 | } 16 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/database/DatabaseManagerServiceImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.database; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.GraphDatabaseApi; 10 | import com.albertoventurini.graphdbplugin.database.neo4j.bolt.Neo4jBoltDatabase; 11 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.DataSourceType; 12 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state.DataSourceApi; 13 | 14 | public class DatabaseManagerServiceImpl implements DatabaseManagerService { 15 | 16 | public DatabaseManagerServiceImpl() { 17 | } 18 | 19 | public GraphDatabaseApi getDatabaseFor(final DataSourceApi dataSource) { 20 | if (dataSource.getDataSourceType() == DataSourceType.NEO4J_BOLT) { 21 | return new Neo4jBoltDatabase(dataSource.getConfiguration()); 22 | } 23 | throw new RuntimeException(String.format("Database for data source [%s] does not exists", 24 | dataSource.getDataSourceType())); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/formatter/CypherCodeStyleSettings.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.formatter; 8 | 9 | import com.intellij.psi.codeStyle.CodeStyleSettings; 10 | import com.intellij.psi.codeStyle.CustomCodeStyleSettings; 11 | 12 | public class CypherCodeStyleSettings extends CustomCodeStyleSettings { 13 | CypherCodeStyleSettings(CodeStyleSettings container) { 14 | super("CypherCodeStyleSettings", container); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/services/ExecutorService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.services; 8 | 9 | import com.intellij.openapi.application.ModalityState; 10 | 11 | import java.util.concurrent.Callable; 12 | import java.util.function.Consumer; 13 | 14 | public interface ExecutorService { 15 | void runInBackground(Callable task, Consumer onSuccess, Consumer onFailure); 16 | 17 | void runInBackground(Callable task, Consumer onSuccess, Consumer onFailure, ModalityState modalityState); 18 | } 19 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/event/CopyQueryOutputEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.event; 8 | 9 | import com.intellij.util.messages.Topic; 10 | 11 | public interface CopyQueryOutputEvent { 12 | 13 | Topic COPY_QUERY_OUTPUT_TOPIC = Topic.create("GraphDatabaseConsole.CopyQueryOutputTopic", CopyQueryOutputEvent.class); 14 | 15 | void copyQueryOutputToClipboard(); 16 | } 17 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/event/OpenTabEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.event; 8 | 9 | import com.intellij.util.messages.Topic; 10 | 11 | public interface OpenTabEvent { 12 | 13 | Topic OPEN_TAB_TOPIC = Topic.create("GraphDatabaseConsole.OpenTabTopic", OpenTabEvent.class); 14 | 15 | void openTab(String graph); 16 | } 17 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/event/PluginSettingsUpdated.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.event; 8 | 9 | import com.intellij.util.messages.Topic; 10 | 11 | public interface PluginSettingsUpdated { 12 | 13 | Topic TOPIC = Topic.create("GraphDatabaseConsole.SettingsUpdated", PluginSettingsUpdated.class); 14 | 15 | void settingsUpdated(); 16 | } 17 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/event/QueryExecutionProcessEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.event; 8 | 9 | import com.albertoventurini.graphdbplugin.jetbrains.actions.execute.ExecuteQueryPayload; 10 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state.DataSourceApi; 11 | import com.intellij.util.messages.Topic; 12 | import com.albertoventurini.graphdbplugin.database.api.query.GraphQueryResult; 13 | 14 | public interface QueryExecutionProcessEvent { 15 | 16 | Topic QUERY_EXECUTION_PROCESS_TOPIC = 17 | Topic.create("GraphDatabaseConsole.QueryExecutionProcessTopic", QueryExecutionProcessEvent.class); 18 | 19 | void executionStarted(DataSourceApi dataSource, ExecuteQueryPayload payload); 20 | 21 | void resultReceived(ExecuteQueryPayload payload, GraphQueryResult result); 22 | 23 | void postResultReceived(ExecuteQueryPayload payload); 24 | 25 | void handleError(ExecuteQueryPayload payload, Exception exception); 26 | 27 | void executionCompleted(ExecuteQueryPayload payload); 28 | } 29 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/event/QueryParametersRetrievalErrorEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.event; 8 | 9 | import com.intellij.openapi.editor.Editor; 10 | import com.intellij.util.messages.Topic; 11 | 12 | public interface QueryParametersRetrievalErrorEvent { 13 | 14 | Topic QUERY_PARAMETERS_RETRIEVAL_ERROR_EVENT_TOPIC = 15 | Topic.create("GraphDatabaseConsole.QueryParametersRetrievalErrorEventTopic", QueryParametersRetrievalErrorEvent.class); 16 | 17 | String PARAMS_ERROR_COMMON_MSG = "Failed to retrieve query parameters"; 18 | void handleError(Exception exception, Editor editor); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/event/QueryPlanEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.event; 8 | 9 | import com.intellij.util.messages.Topic; 10 | import com.albertoventurini.graphdbplugin.database.api.query.GraphQueryResult; 11 | 12 | public interface QueryPlanEvent { 13 | 14 | Topic QUERY_PLAN_EVENT = Topic.create("GraphDatabaseConsole.QueryPlanEvent", QueryPlanEvent.class); 15 | 16 | void queryPlanReceived(String query, GraphQueryResult result); 17 | } 18 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/event/VersionFetchingProcessEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.event; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.data.GraphDatabaseVersion; 10 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state.DataSourceApi; 11 | import com.intellij.util.messages.Topic; 12 | 13 | public interface VersionFetchingProcessEvent { 14 | 15 | Topic VERSION_FETCHING_PROCESS_TOPIC = 16 | Topic.create("GraphDatabaseConsole.VersionFetchingProcessTopic", VersionFetchingProcessEvent.class); 17 | 18 | void processStarted(DataSourceApi dataSource); 19 | 20 | void versionReceived(GraphDatabaseVersion version); 21 | 22 | 23 | void handleError(Exception exception); 24 | } 25 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/graph/PsiInvocationSignature.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.graph; 2 | 3 | import com.albertoventurini.graphdbplugin.database.neo4j.bytecodedl.InvocationSignature; 4 | import com.intellij.openapi.project.Project; 5 | import com.intellij.psi.PsiMethod; 6 | 7 | /** 8 | * @author daozhe@alibaba-inc.com 9 | * @date 2023/12/3 16:05 10 | */ 11 | public class PsiInvocationSignature extends InvocationSignature{ 12 | 13 | public PsiInvocationSignature(String insn){ 14 | super(insn); 15 | } 16 | 17 | public PsiMethod getCaller(Project project){ 18 | PsiMethodSignature psiMethodSignature = new PsiMethodSignature(this.getCallerSignature()); 19 | return psiMethodSignature.getMethod(project); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/params/ParameterRootType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.params; 8 | 9 | import com.intellij.execution.console.ConsoleRootType; 10 | import org.jetbrains.annotations.NotNull; 11 | 12 | public class ParameterRootType extends ConsoleRootType { 13 | 14 | @NotNull 15 | public static ParameterRootType getInstance() { 16 | return findByClass(ParameterRootType.class); 17 | } 18 | 19 | ParameterRootType() { 20 | super("graphdb-parameters", "Graph Database parameters"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/params/ParametersProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.params; 8 | 9 | public interface ParametersProvider { 10 | 11 | String getGlobalParametersJson(); 12 | 13 | String getFileSpecificParametersJson(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/plan/QueryPlanArgumentKeys.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.plan; 8 | 9 | enum QueryPlanArgumentKeys { 10 | ESTIMATED_ROWS("EstimatedRows"), 11 | DB_HITS("DbHits"), 12 | ROWS("Rows"), 13 | 14 | PLANNER_IMPL("planner-impl"), 15 | RUNTIME("runtime"), 16 | KEY_NAMES("KeyNames"), 17 | RUNTIME_IMPL("runtime-impl"), 18 | PLANNER("planner"), 19 | VERSION("version"); 20 | 21 | private String key; 22 | 23 | QueryPlanArgumentKeys(String key) { 24 | this.key = key; 25 | } 26 | 27 | public String getKey() { 28 | return key; 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/status/ExecutionTextPanel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.status; 8 | 9 | import com.intellij.openapi.wm.impl.status.TextPanel; 10 | 11 | public class ExecutionTextPanel extends TextPanel { 12 | } 13 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/table/QueryResultTableModel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.table; 8 | 9 | import com.intellij.ui.treeStructure.Tree; 10 | 11 | import javax.swing.table.DefaultTableModel; 12 | 13 | public class QueryResultTableModel extends DefaultTableModel { 14 | 15 | @Override 16 | public boolean isCellEditable(int row, int column) { 17 | Object valueAt = getValueAt(row, column); 18 | return valueAt != null && valueAt instanceof Tree; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/table/editor/TreeModelTableCellEditor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.table.editor; 8 | 9 | import com.intellij.ui.treeStructure.Tree; 10 | 11 | import javax.swing.AbstractCellEditor; 12 | import javax.swing.JTable; 13 | import javax.swing.table.TableCellEditor; 14 | import java.awt.Component; 15 | 16 | public class TreeModelTableCellEditor extends AbstractCellEditor implements TableCellEditor { 17 | 18 | private Tree tree; 19 | 20 | @Override 21 | public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { 22 | tree = (Tree) value; 23 | return tree; 24 | } 25 | 26 | @Override 27 | public Object getCellEditorValue() { 28 | return tree; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/console/table/renderer/TreeModelTableCellRenderer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.console.table.renderer; 8 | 9 | import com.intellij.ui.treeStructure.Tree; 10 | 11 | import javax.swing.JTable; 12 | import javax.swing.table.TableCellRenderer; 13 | import java.awt.Component; 14 | 15 | public class TreeModelTableCellRenderer implements TableCellRenderer { 16 | 17 | @Override 18 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 19 | return (Tree) value; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/DataSourcesToolWindow.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource; 8 | 9 | import com.intellij.openapi.project.Project; 10 | import com.intellij.openapi.wm.ToolWindow; 11 | import com.intellij.openapi.wm.ToolWindowFactory; 12 | import org.jetbrains.annotations.NotNull; 13 | 14 | public class DataSourcesToolWindow implements ToolWindowFactory { 15 | 16 | @Override 17 | public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) { 18 | project.getService(DataSourcesView.class).initToolWindow(project, toolWindow); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/actions/RefreshDataSourcesAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.actions; 8 | 9 | import com.intellij.icons.AllIcons; 10 | import com.intellij.openapi.actionSystem.AnActionEvent; 11 | import com.intellij.ui.AnActionButton; 12 | import com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.DataSourcesView; 13 | import org.jetbrains.annotations.NotNull; 14 | 15 | public class RefreshDataSourcesAction extends AnActionButton { 16 | 17 | private final DataSourcesView dataSourcesView; 18 | 19 | public RefreshDataSourcesAction(DataSourcesView dataSourcesView) { 20 | super("Refresh", "Refresh all data sources", AllIcons.Actions.Refresh); 21 | this.dataSourcesView = dataSourcesView; 22 | } 23 | 24 | @Override 25 | public void actionPerformed(@NotNull final AnActionEvent e) { 26 | dataSourcesView.refreshDataSourcesMetadata(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/interactions/NotImplementedDataSourceAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.interactions; 8 | 9 | import com.intellij.openapi.actionSystem.AnAction; 10 | import com.intellij.openapi.actionSystem.AnActionEvent; 11 | import org.jetbrains.annotations.Nullable; 12 | 13 | import javax.swing.Icon; 14 | 15 | public class NotImplementedDataSourceAction extends AnAction { 16 | 17 | public NotImplementedDataSourceAction(@Nullable String text, @Nullable String description, @Nullable Icon icon) { 18 | super(text, description, icon); 19 | } 20 | 21 | @Override 22 | public void actionPerformed(AnActionEvent e) { 23 | // do nothing 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/metadata/DataSourceTreeUpdater.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.metadata; 2 | 3 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata.DataSourceMetadata; 4 | import com.intellij.ui.treeStructure.PatchedDefaultMutableTreeNode; 5 | 6 | /** 7 | * Updates the data source tree according to the provided data source metadata. 8 | */ 9 | interface DataSourceTreeUpdater { 10 | 11 | /** 12 | * Given a tree root and a datasource metadata object, this method 13 | * displays the data on the tree. 14 | * @param metadata the metadata 15 | */ 16 | void updateTree(PatchedDefaultMutableTreeNode dataSourceRootTreeNode, T metadata); 17 | } 18 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/metadata/DataSourceTreeUpdaters.java: -------------------------------------------------------------------------------- 1 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.metadata; 2 | 3 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.DataSourceType; 4 | import com.intellij.openapi.components.Service; 5 | 6 | import java.util.Map; 7 | import java.util.Optional; 8 | 9 | /** 10 | * Maintains a collection of known {@link DataSourceTreeUpdater} objects. 11 | */ 12 | @Service 13 | final class DataSourceTreeUpdaters { 14 | 15 | private final Map handlers; 16 | 17 | DataSourceTreeUpdaters() { 18 | this.handlers = Map.of( 19 | DataSourceType.NEO4J_BOLT, new Neo4jBoltTreeUpdater() 20 | ); 21 | } 22 | 23 | Optional get(final DataSourceType dataSourceType) { 24 | return Optional.ofNullable(handlers.get(dataSourceType)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/metadata/MetadataRetrieveEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.metadata; 8 | 9 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state.DataSourceApi; 10 | import com.intellij.util.messages.Topic; 11 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.metadata.DataSourceMetadata; 12 | 13 | public interface MetadataRetrieveEvent { 14 | 15 | Topic METADATA_RETRIEVE_EVENT = Topic.create("GraphDatabaseDataSource.MetadataRetrieve", MetadataRetrieveEvent.class); 16 | 17 | void startMetadataRefresh(DataSourceApi nodeDataSource); 18 | 19 | void metadataRefreshSucceed(DataSourceApi nodeDataSource); 20 | 21 | void metadataRefreshFailed(DataSourceApi nodeDataSource, Exception exception); 22 | } 23 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/metadata/actions/MetadataLabelAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.metadata.actions; 8 | 9 | import javax.swing.*; 10 | 11 | public class MetadataLabelAction extends MetadataAction { 12 | 13 | private static final String QUERY = "MATCH (n:`%s`) RETURN n LIMIT 25"; 14 | 15 | MetadataLabelAction(String data, String dataSourceUuid, String title, String description, Icon icon) { 16 | super(data, dataSourceUuid, title, description, icon); 17 | } 18 | 19 | @Override 20 | protected String getQuery(String data) { 21 | return String.format(QUERY, data); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/metadata/actions/MetadataLabelFromAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.metadata.actions; 8 | 9 | import javax.swing.*; 10 | 11 | public class MetadataLabelFromAction extends MetadataAction { 12 | 13 | private static final String QUERY = "MATCH (n:`%s`)-[r]->() RETURN type(r), r LIMIT 25"; 14 | 15 | MetadataLabelFromAction(String data, String dataSourceUuid, String title, String description, Icon icon) { 16 | super(data, dataSourceUuid, title, description, icon); 17 | } 18 | 19 | @Override 20 | protected String getQuery(String data) { 21 | return String.format(QUERY, data); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/metadata/actions/MetadataLabelToAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.metadata.actions; 8 | 9 | import javax.swing.*; 10 | 11 | public class MetadataLabelToAction extends MetadataAction { 12 | 13 | private static final String QUERY = "MATCH (n:`%s`)<-[r]-() RETURN type(r), r LIMIT 25"; 14 | 15 | MetadataLabelToAction(String data, String dataSourceUuid, String title, String description, Icon icon) { 16 | super(data, dataSourceUuid, title, description, icon); 17 | } 18 | 19 | @Override 20 | protected String getQuery(String data) { 21 | return String.format(QUERY, data); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/metadata/actions/MetadataPropertyKeyAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.metadata.actions; 8 | 9 | import javax.swing.*; 10 | 11 | public class MetadataPropertyKeyAction extends MetadataAction { 12 | 13 | private static final String QUERY = "MATCH (n) WHERE EXISTS(n.%1$s) " 14 | + "RETURN DISTINCT \"node\" as element, n.%1$s AS %1$s LIMIT 25 " 15 | + "UNION ALL MATCH ()-[r]-() WHERE EXISTS(r.%1$s) " 16 | + "RETURN DISTINCT \"relationship\" AS element, r.%1$s AS %1$s LIMIT 25"; 17 | 18 | MetadataPropertyKeyAction(String data, String dataSourceUuid, String title, String description, Icon icon) { 19 | super(data, dataSourceUuid, title, description, icon); 20 | } 21 | 22 | @Override 23 | protected String getQuery(String data) { 24 | return String.format(QUERY, data); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/metadata/actions/MetadataRelationshipAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.metadata.actions; 8 | 9 | import javax.swing.*; 10 | 11 | public class MetadataRelationshipAction extends MetadataAction { 12 | 13 | private static final String QUERY = "MATCH p=()-[r:`%s`]->() RETURN p LIMIT 25"; 14 | 15 | MetadataRelationshipAction(String data, String dataSourceUuid, String title, String description, Icon icon) { 16 | super(data, dataSourceUuid, title, description, icon); 17 | } 18 | 19 | @Override 20 | protected String getQuery(String relationship) { 21 | return String.format(QUERY, relationship); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/metadata/dto/ContextMenu.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.metadata.dto; 8 | 9 | import com.intellij.openapi.actionSystem.DataContext; 10 | 11 | public interface ContextMenu { 12 | void showPopup(DataContext dataContext); 13 | } 14 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/tree/LabelTreeNodeModel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.tree; 8 | 9 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state.DataSourceApi; 10 | 11 | import java.util.Optional; 12 | 13 | public class LabelTreeNodeModel extends MetadataTreeNodeModel { 14 | 15 | private static final String NAME_WITH_COUNT = "%s (%d)"; 16 | private Long count; 17 | 18 | public LabelTreeNodeModel(Neo4jTreeNodeType type, DataSourceApi dataSourceApi, String value, Long count) { 19 | super(type, dataSourceApi, value); 20 | this.count = count; 21 | } 22 | 23 | @Override 24 | public Optional getText() { 25 | return Optional.of(String.format(NAME_WITH_COUNT, getValue().orElse(""), count)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/tree/Neo4jEntityViewNodeType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.tree; 8 | 9 | public enum Neo4jEntityViewNodeType implements NodeType { 10 | NODE, 11 | NODE_LABELS, 12 | NODE_PROPERIES, 13 | NODE_LIST, 14 | NODE_MAP, 15 | NODE_VALUE, 16 | 17 | RELATIONSHIP, 18 | RELATIONSHIP_TYPES, 19 | RELATIONSHIP_PROPERTIES, 20 | RELATIONSHIP_LIST, 21 | RELATIONSHIP_MAP, 22 | RELATIONSHIP_VALUE, 23 | 24 | PATH, 25 | OTHER; 26 | 27 | Neo4jEntityViewNodeType() { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/tree/Neo4jTreeNodeType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.tree; 8 | 9 | public enum Neo4jTreeNodeType implements NodeType { 10 | ROOT, 11 | DATASOURCE, 12 | VERSION, 13 | INDEXES, 14 | INDEX, 15 | CONSTRAINTS, 16 | CONSTRAINT, 17 | LABELS, 18 | LABEL, 19 | RELATIONSHIPS, 20 | RELATIONSHIP, 21 | PROPERTY_KEYS, 22 | PROPERTY_KEY, 23 | STORED_PROCEDURES, 24 | STORED_PROCEDURE, 25 | FUNCTIONS, 26 | FUNCTION; 27 | 28 | Neo4jTreeNodeType() { 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/tree/NodeType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.tree; 8 | 9 | public interface NodeType { 10 | } 11 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/tree/RelationshipTypeTreeNodeModel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.tree; 8 | 9 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state.DataSourceApi; 10 | 11 | import java.util.Optional; 12 | 13 | public class RelationshipTypeTreeNodeModel extends MetadataTreeNodeModel { 14 | 15 | private static final String NAME_WITH_COUNT = "%s (%d)"; 16 | private Long count; 17 | 18 | public RelationshipTypeTreeNodeModel(Neo4jTreeNodeType type, DataSourceApi dataSourceApi, String value, Long count) { 19 | super(type, dataSourceApi, value); 20 | this.count = count; 21 | } 22 | 23 | @Override 24 | public Optional getText() { 25 | return super.getText() 26 | .map(text -> String.format(NAME_WITH_COUNT, text, count)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/datasource/tree/dto/ValueWithIcon.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.datasource.tree.dto; 8 | 9 | 10 | import javax.swing.Icon; 11 | 12 | public class ValueWithIcon { 13 | 14 | private final Icon icon; 15 | private final String value; 16 | 17 | public ValueWithIcon(Icon icon, String value) { 18 | this.icon = icon; 19 | this.value = value; 20 | } 21 | 22 | public Icon getIcon() { 23 | return icon; 24 | } 25 | 26 | public String getValue() { 27 | return value; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/ui/helpers/KeyValuePair.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.helpers; 8 | 9 | public class KeyValuePair { 10 | 11 | private final String key; 12 | private final Object value; 13 | private final boolean isValueData; 14 | 15 | public KeyValuePair(String key, Object value) { 16 | this(key, value, false); 17 | } 18 | 19 | public KeyValuePair(String key, Object value, boolean isValueData) { 20 | this.key = key; 21 | this.value = value; 22 | this.isValueData = isValueData; 23 | } 24 | 25 | public String getKey() { 26 | return key; 27 | } 28 | 29 | public Object getValue() { 30 | return value; 31 | } 32 | 33 | public boolean isValueData() { 34 | return isValueData; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return key + ": " + value.toString(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/util/NameUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.util; 8 | 9 | import com.albertoventurini.graphdbplugin.jetbrains.component.datasource.state.DataSourceApi; 10 | import com.albertoventurini.graphdbplugin.platform.GraphConstants; 11 | 12 | public final class NameUtil { 13 | 14 | public static String createDataSourceFileName(DataSourceApi dataSource) { 15 | return GraphConstants.BOUND_DATA_SOURCE_PREFIX + dataSource.getUUID() + "." + dataSource.getDescription().getDefaultFileExtension(); 16 | } 17 | 18 | public static String extractDataSourceUUID(String fileName) { 19 | int beginIndex = GraphConstants.BOUND_DATA_SOURCE_PREFIX.length(); 20 | int endIndex = beginIndex + 36; 21 | return fileName.substring(beginIndex, endIndex); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/util/Notifier.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.util; 8 | 9 | import com.intellij.notification.Notification; 10 | import com.intellij.notification.NotificationType; 11 | import com.intellij.notification.Notifications; 12 | 13 | public class Notifier { 14 | 15 | private static final String GROUP_DISPLAY_ID = "Graph Database Support"; 16 | 17 | public static void info(String title, String message) { 18 | notify(title, message, NotificationType.INFORMATION); 19 | } 20 | 21 | public static void warn(String title, String message) { 22 | notify(title, message, NotificationType.WARNING); 23 | } 24 | 25 | public static void error(String title, String message) { 26 | notify(title, message, NotificationType.ERROR); 27 | } 28 | 29 | private static void notify(String title, String message, NotificationType notificationType) { 30 | Notifications.Bus.notify(new Notification(GROUP_DISPLAY_ID, title, message, notificationType)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/util/PluginUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.util; 8 | 9 | import com.intellij.ide.plugins.IdeaPluginDescriptor; 10 | import com.intellij.ide.plugins.PluginManager; 11 | import com.intellij.ide.plugins.PluginManagerCore; 12 | import com.intellij.openapi.extensions.PluginId; 13 | import com.albertoventurini.graphdbplugin.platform.GraphConstants; 14 | 15 | public class PluginUtil { 16 | 17 | private static IdeaPluginDescriptor plugin; 18 | 19 | public static String getVersion() { 20 | return plugin().getVersion(); 21 | } 22 | 23 | public static boolean isEnabled() { 24 | return plugin().isEnabled(); 25 | } 26 | 27 | private static IdeaPluginDescriptor plugin() { 28 | if (plugin == null) { 29 | plugin = PluginManagerCore.getPlugin(PluginId.getId(GraphConstants.PLUGIN_ID)); 30 | } 31 | return plugin; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ui/jetbrains/src/main/java/com/albertoventurini/graphdbplugin/jetbrains/util/Validation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.util; 8 | 9 | import com.intellij.openapi.ui.ValidationInfo; 10 | 11 | import javax.swing.JComponent; 12 | 13 | public class Validation { 14 | 15 | public static ValidationInfo validation(String message, JComponent component) { 16 | return new ValidationInfo(message, component); 17 | } 18 | 19 | public static ValidationInfo warning(String message, JComponent component) { 20 | return new ValidationInfo(message, component).asWarning().withOKEnabled(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ui/jetbrains/src/test/java/com/albertoventurini/graphdbplugin/jetbrains/ui/helpers/UiHelperTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.jetbrains.ui.helpers; 8 | 9 | import com.intellij.ui.treeStructure.PatchedDefaultMutableTreeNode; 10 | import org.junit.Test; 11 | 12 | import static org.assertj.core.api.Assertions.assertThat; 13 | 14 | public class UiHelperTest { 15 | 16 | @Test 17 | public void nullValueToTreeNode() throws Exception { 18 | PatchedDefaultMutableTreeNode treeNode = UiHelper.keyValueToTreeNode("key", "VALUE", null, null); 19 | assertThat(treeNode).isNotNull(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ui/visualization/build.gradle: -------------------------------------------------------------------------------- 1 | // Copied and adapted from plugin "Graph Database Support" 2 | // by Neueda Technologies, Ltd. 3 | // Modified by Alberto Venturini, 2022 4 | apply plugin: "org.jetbrains.intellij" 5 | 6 | intellij { 7 | version = intellijSdkVersion 8 | instrumentCode = true 9 | plugins = ['java'] 10 | } 11 | 12 | dependencies { 13 | implementation "de.sciss:prefuse-core:$versionPrefuse" 14 | 15 | implementation project(":platform") 16 | implementation project(':database:neo4j') 17 | implementation project(':database:api') 18 | 19 | testImplementation "org.mockito:mockito-core:$versionMockito" 20 | testImplementation "org.assertj:assertj-core:$versionAssertj" 21 | testImplementation "de.sciss:prefuse-demos:$versionPrefuse" 22 | } 23 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/VisualizationApi.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.data.GraphNode; 10 | import com.albertoventurini.graphdbplugin.database.api.data.GraphRelationship; 11 | import com.albertoventurini.graphdbplugin.visualization.events.EventType; 12 | import com.albertoventurini.graphdbplugin.visualization.events.NodeCallback; 13 | import com.albertoventurini.graphdbplugin.visualization.events.RelationshipCallback; 14 | 15 | import javax.swing.*; 16 | 17 | public interface VisualizationApi { 18 | 19 | JComponent getCanvas(); 20 | 21 | void addNode(GraphNode node); 22 | 23 | void addRelation(GraphRelationship relationship); 24 | 25 | void clear(); 26 | 27 | void paint(); 28 | 29 | void stop(); 30 | 31 | void addNodeListener(EventType type, NodeCallback action); 32 | 33 | void addEdgeListener(EventType type, RelationshipCallback action); 34 | 35 | void resetPan(); 36 | 37 | void updateSettings(); 38 | } 39 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/constants/GraphColumns.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.constants; 8 | 9 | public class GraphColumns { 10 | public static final String ID = "id"; 11 | public static final String TYPE = "type"; 12 | public static final String TITLE = "title"; 13 | } 14 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/constants/GraphGroups.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.constants; 8 | 9 | public class GraphGroups { 10 | public static final String GRAPH = "graph"; 11 | public static final String NODES = "graph.nodes"; 12 | public static final String EDGES = "graph.edges"; 13 | public static final String NODE_LABEL = "nodelabel"; 14 | public static final String EDGE_LABEL = "edgelabel"; 15 | } 16 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/constants/VisualizationParameters.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.constants; 8 | 9 | public class VisualizationParameters { 10 | public static final int NODE_DIAMETER = 50; 11 | public static final float EDGE_THICKNESS = 3; 12 | } 13 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/events/EventType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.events; 8 | 9 | public enum EventType { 10 | HOVER_START, 11 | HOVER_END, 12 | CLICK 13 | } 14 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/events/NodeCallback.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.events; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.data.GraphNode; 10 | import prefuse.visual.VisualItem; 11 | 12 | import java.awt.event.MouseEvent; 13 | 14 | @FunctionalInterface 15 | public interface NodeCallback { 16 | void accept(GraphNode node, VisualItem item, MouseEvent e); 17 | } 18 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/events/RelationshipCallback.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.events; 8 | 9 | import com.albertoventurini.graphdbplugin.database.api.data.GraphRelationship; 10 | import prefuse.visual.VisualItem; 11 | 12 | import java.awt.event.MouseEvent; 13 | 14 | @FunctionalInterface 15 | public interface RelationshipCallback { 16 | void accept(GraphRelationship relationship, VisualItem item, MouseEvent e); 17 | } 18 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/layouts/AnimationPacer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.layouts; 8 | 9 | import prefuse.activity.Pacer; 10 | 11 | public class AnimationPacer implements Pacer { 12 | 13 | @Override 14 | public double pace(double f) { 15 | return paceExp(f); 16 | } 17 | 18 | public double paceExp(double f) { 19 | double v = 1 + Math.exp(f) * 1.3; 20 | return v == 2 ? 0 : v > 3 ? 1 : -(2 - v); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/layouts/CenteredLayout.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.layouts; 8 | 9 | import prefuse.action.layout.Layout; 10 | import prefuse.visual.DecoratorItem; 11 | import prefuse.visual.VisualItem; 12 | 13 | import java.awt.geom.Rectangle2D; 14 | import java.util.Iterator; 15 | 16 | public class CenteredLayout extends Layout { 17 | public CenteredLayout(String group) { 18 | super(group); 19 | } 20 | 21 | @Override 22 | public void run(double frac) { 23 | Iterator iter = m_vis.items(m_group); 24 | while (iter.hasNext()) { 25 | DecoratorItem decorator = (DecoratorItem) iter.next(); 26 | VisualItem decoratedItem = decorator.getDecoratedItem(); 27 | Rectangle2D bounds = decoratedItem.getBounds(); 28 | 29 | double x = bounds.getCenterX(); 30 | double y = bounds.getCenterY(); 31 | 32 | setX(decorator, null, x); 33 | setY(decorator, null, y); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/layouts/CustomItemSorter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.layouts; 8 | 9 | import prefuse.visual.DecoratorItem; 10 | import prefuse.visual.VisualItem; 11 | import prefuse.visual.sort.ItemSorter; 12 | 13 | public class CustomItemSorter extends ItemSorter { 14 | 15 | // Value of 2^22, which is minimal score gap before the next category 16 | public static final int GAP = 4194304; 17 | 18 | @Override 19 | public int score(VisualItem item) { 20 | if (item instanceof DecoratorItem) { 21 | VisualItem decoratedItem = ((DecoratorItem) item).getDecoratedItem(); 22 | return layerByRow(decoratedItem) + 1; 23 | } 24 | 25 | return layerByRow(item); 26 | } 27 | 28 | private int layerByRow(VisualItem item) { 29 | return super.score(item) + (item.getRow() * 2 % GAP); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/layouts/RepaintAndRepositionAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.layouts; 8 | 9 | import com.albertoventurini.graphdbplugin.visualization.GraphDisplay; 10 | import com.albertoventurini.graphdbplugin.visualization.util.PrefuseUtil; 11 | import prefuse.Visualization; 12 | import prefuse.action.RepaintAction; 13 | 14 | public class RepaintAndRepositionAction extends RepaintAction { 15 | 16 | private Visualization visualization; 17 | private GraphDisplay display; 18 | 19 | public RepaintAndRepositionAction(Visualization visualization, GraphDisplay display) { 20 | super(visualization); 21 | this.visualization = visualization; 22 | this.display = display; 23 | } 24 | 25 | @Override 26 | public void run(double frac) { 27 | PrefuseUtil.zoomAndPanToFit(visualization, display); 28 | super.run(frac); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/services/LookAndFeelService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.services; 8 | 9 | import java.awt.*; 10 | 11 | public interface LookAndFeelService { 12 | 13 | Color getBackgroundColor(); 14 | Color getBorderColor(); 15 | Color getNodeStrokeColor(); 16 | Color getNodeStrokeHoverColor(); 17 | Color getNodeFillColor(); 18 | Color getNodeFillHoverColor(); 19 | Color getEdgeStrokeColor(); 20 | Color getEdgeFillColor(); 21 | 22 | Color getTextColor(); 23 | 24 | boolean isGraphViewZoomInverted(); 25 | } 26 | -------------------------------------------------------------------------------- /ui/visualization/src/main/java/com/albertoventurini/graphdbplugin/visualization/util/PrefuseUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copied and adapted from plugin 3 | * Graph Database Support 4 | * by Neueda Technologies, Ltd. 5 | * Modified by Alberto Venturini, 2022 6 | */ 7 | package com.albertoventurini.graphdbplugin.visualization.util; 8 | 9 | import prefuse.Display; 10 | import prefuse.Visualization; 11 | import prefuse.util.display.DisplayLib; 12 | 13 | import java.awt.geom.Rectangle2D; 14 | 15 | public class PrefuseUtil { 16 | 17 | public static final int DURATION = 0; 18 | 19 | public static void zoomAndPanToFit(Visualization visualization, Display display) { 20 | Rectangle2D bounds = visualization.getBounds(Visualization.ALL_ITEMS); 21 | 22 | if (bounds.getWidth() == 0 && bounds.getHeight() == 0) { 23 | return; 24 | } 25 | 26 | DisplayLib.fitViewToBounds(display, bounds, DURATION); 27 | } 28 | } 29 | --------------------------------------------------------------------------------