├── .github └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── 1g-playground ├── 1g-playground-cli │ ├── .gitignore │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── software │ │ │ └── amazon │ │ │ └── neptune │ │ │ └── onegraph │ │ │ └── playground │ │ │ └── client │ │ │ ├── Commands.java │ │ │ ├── Neptune1GPlaygroundCLIApplication.java │ │ │ ├── api │ │ │ ├── API.java │ │ │ ├── ConfigType.java │ │ │ ├── DataFormat.java │ │ │ ├── Endpoints.java │ │ │ └── QueryType.java │ │ │ ├── request │ │ │ ├── LoadRequest.java │ │ │ ├── Request.java │ │ │ └── SettingsRequest.java │ │ │ ├── response │ │ │ ├── InfoResponse.java │ │ │ ├── QueryResponse.java │ │ │ ├── QueryResponseType.java │ │ │ └── SettingsResponse.java │ │ │ ├── scenarios │ │ │ ├── Scenario.java │ │ │ ├── Scenario1.java │ │ │ ├── Scenario2.java │ │ │ └── Scenario3.java │ │ │ └── service │ │ │ ├── DataService.java │ │ │ ├── InfoService.java │ │ │ ├── QueryService.java │ │ │ ├── ScenarioService.java │ │ │ ├── ServiceException.java │ │ │ └── SettingsService.java │ │ └── resources │ │ ├── application.properties │ │ ├── endpoints.properties │ │ ├── scenario1 │ │ ├── conclusion.txt │ │ ├── data │ │ │ ├── scenario1NTriples.nt │ │ │ ├── scenario1NeptuneCSV_edges.csv │ │ │ └── scenario1NeptuneCSV_nodes.csv │ │ ├── steps │ │ │ ├── step1.txt │ │ │ ├── step2.txt │ │ │ ├── step3.txt │ │ │ ├── step4.txt │ │ │ ├── step5.txt │ │ │ ├── step6.txt │ │ │ ├── step7.txt │ │ │ ├── step8.txt │ │ │ └── step9.txt │ │ └── welcome.txt │ │ ├── scenario2 │ │ ├── conclusion.txt │ │ ├── data │ │ │ ├── scenario2NeptuneCSV_edges.csv │ │ │ ├── scenario2NeptuneCSV_nodes.csv │ │ │ └── scenario2Turtle.ttl │ │ ├── steps │ │ │ ├── step1.txt │ │ │ ├── step10.txt │ │ │ ├── step2.txt │ │ │ ├── step3.txt │ │ │ ├── step4.txt │ │ │ ├── step5.txt │ │ │ ├── step6.txt │ │ │ ├── step7.txt │ │ │ ├── step8.txt │ │ │ └── step9.txt │ │ └── welcome.txt │ │ └── scenario3 │ │ ├── conclusion.txt │ │ ├── data │ │ ├── scenario3NeptuneCSV_edges.csv │ │ ├── scenario3NeptuneCSV_nodes.csv │ │ └── scenario3Turtle.ttl │ │ ├── queries │ │ ├── gremlin.txt │ │ ├── sparql_ask.rq │ │ ├── sparql_construct.rq │ │ └── sparql_select.rq │ │ ├── steps │ │ ├── step1.txt │ │ ├── step2.txt │ │ ├── step3.txt │ │ ├── step4.txt │ │ ├── step5.txt │ │ ├── step6.txt │ │ ├── step7.txt │ │ ├── step8.txt │ │ └── step9.txt │ │ └── welcome.txt ├── 1g-playground-server │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── software │ │ │ │ └── amazon │ │ │ │ └── neptune │ │ │ │ └── onegraph │ │ │ │ └── playground │ │ │ │ └── server │ │ │ │ ├── Neptune1GPlaygroundServerApplication.java │ │ │ │ ├── api │ │ │ │ ├── controller │ │ │ │ │ ├── DataController.java │ │ │ │ │ ├── InfoController.java │ │ │ │ │ ├── QueryController.java │ │ │ │ │ └── SettingsController.java │ │ │ │ ├── request │ │ │ │ │ ├── ConfigType.java │ │ │ │ │ ├── DataFormat.java │ │ │ │ │ ├── LoadRequest.java │ │ │ │ │ └── SettingsRequest.java │ │ │ │ └── response │ │ │ │ │ ├── InfoResponse.java │ │ │ │ │ ├── QueryResponse.java │ │ │ │ │ ├── QueryResponseType.java │ │ │ │ │ └── SettingsResponse.java │ │ │ │ ├── constants │ │ │ │ └── URLConstants.java │ │ │ │ ├── io │ │ │ │ ├── parsing │ │ │ │ │ ├── ConfigurationParser.java │ │ │ │ │ ├── LPGParser.java │ │ │ │ │ ├── ParserException.java │ │ │ │ │ ├── RDFParser.java │ │ │ │ │ └── ogparser │ │ │ │ │ │ ├── CharacterReader.java │ │ │ │ │ │ ├── LiteralProcessing.java │ │ │ │ │ │ ├── OGParser.java │ │ │ │ │ │ ├── Token.java │ │ │ │ │ │ ├── TokenType.java │ │ │ │ │ │ └── Tokenizer.java │ │ │ │ └── serializing │ │ │ │ │ ├── OGSerializer.java │ │ │ │ │ ├── RDFSerializer.java │ │ │ │ │ ├── SerializerException.java │ │ │ │ │ └── lpgserializer │ │ │ │ │ ├── LPGSerializer.java │ │ │ │ │ ├── NeptuneCSVCardinality.java │ │ │ │ │ ├── NeptuneCSVColumn.java │ │ │ │ │ ├── NeptuneCSVColumnFactory.java │ │ │ │ │ ├── NeptuneCSVDataType.java │ │ │ │ │ ├── NeptuneCSVDataTypeFactory.java │ │ │ │ │ └── NeptuneCSVSerializer.java │ │ │ │ ├── mapping │ │ │ │ ├── ConverterException.java │ │ │ │ ├── LPGDefaultMappingConfiguration.java │ │ │ │ ├── LPGMapper.java │ │ │ │ ├── LPGMappingConfiguration.java │ │ │ │ ├── LPGToOG.java │ │ │ │ ├── NeptuneCSVConverter.java │ │ │ │ ├── OGToLPG.java │ │ │ │ ├── RDFMapper.java │ │ │ │ └── TinkerPopConverter.java │ │ │ │ ├── model │ │ │ │ ├── LPG │ │ │ │ │ ├── LPGEdge.java │ │ │ │ │ ├── LPGElement.java │ │ │ │ │ ├── LPGGraph.java │ │ │ │ │ ├── LPGProperty.java │ │ │ │ │ └── LPGVertex.java │ │ │ │ ├── RDF │ │ │ │ │ └── LiteralConverter.java │ │ │ │ └── onegraph │ │ │ │ │ ├── dataset │ │ │ │ │ └── OGDataset.java │ │ │ │ │ ├── elements │ │ │ │ │ ├── LPGMappable.java │ │ │ │ │ ├── OGElement.java │ │ │ │ │ ├── OGGraph.java │ │ │ │ │ ├── OGObject.java │ │ │ │ │ ├── OGPredicate.java │ │ │ │ │ ├── OGPredicateString.java │ │ │ │ │ ├── OGReifiableElement.java │ │ │ │ │ ├── OGSimpleNode.java │ │ │ │ │ ├── OGSimpleNodeBNode.java │ │ │ │ │ └── OGSimpleNodeIRI.java │ │ │ │ │ ├── statements │ │ │ │ │ ├── OGMembershipStatement.java │ │ │ │ │ ├── OGPropertyStatement.java │ │ │ │ │ ├── OGRelationshipStatement.java │ │ │ │ │ ├── OGStatement.java │ │ │ │ │ └── OGTripleStatement.java │ │ │ │ │ └── values │ │ │ │ │ └── OGValue.java │ │ │ │ ├── querying │ │ │ │ ├── GremlinQuerying.java │ │ │ │ ├── GremlinQueryingDelegate.java │ │ │ │ ├── QueryException.java │ │ │ │ ├── SPARQLQuerying.java │ │ │ │ └── SPARQLQueryingDelegate.java │ │ │ │ ├── service │ │ │ │ ├── ClearService.java │ │ │ │ ├── ExportService.java │ │ │ │ ├── InfoService.java │ │ │ │ ├── LoadService.java │ │ │ │ ├── QueryService.java │ │ │ │ ├── Service.java │ │ │ │ ├── SettingsService.java │ │ │ │ └── ViewService.java │ │ │ │ ├── servicespring │ │ │ │ ├── ClearServiceSpring.java │ │ │ │ ├── ExportServiceSpring.java │ │ │ │ ├── InfoServiceSpring.java │ │ │ │ ├── LoadServiceSpring.java │ │ │ │ ├── QueryServiceSpring.java │ │ │ │ ├── SettingsServiceSpring.java │ │ │ │ └── ViewServiceSpring.java │ │ │ │ └── state │ │ │ │ ├── State.java │ │ │ │ └── StateSpring.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ ├── java │ │ └── software │ │ │ └── amazon │ │ │ └── neptune │ │ │ └── onegraph │ │ │ └── playground │ │ │ └── server │ │ │ ├── helper │ │ │ └── Equivalence.java │ │ │ ├── mockdata │ │ │ ├── TestData.java │ │ │ ├── io │ │ │ │ ├── IOLPGTestData.java │ │ │ │ ├── IOOGTestData.java │ │ │ │ ├── IORDFTestData.java │ │ │ │ └── IOTinkerPopTestData.java │ │ │ ├── mappingtestdata │ │ │ │ ├── ComplexReifications.java │ │ │ │ ├── CustomMappingConfig.java │ │ │ │ ├── DefaultMappingConfig.java │ │ │ │ ├── DefaultMappingConfigWithCustomConfig.java │ │ │ │ ├── DifferentPropertyValueTypes.java │ │ │ │ ├── LPGEdgeCasesData.java │ │ │ │ ├── MappingTestData.java │ │ │ │ ├── MultipleGraphs.java │ │ │ │ ├── MultipleVertexDefinitions.java │ │ │ │ ├── SimpleReification.java │ │ │ │ └── UnassertedStatementsUsedInAsserted.java │ │ │ ├── service │ │ │ │ ├── ClearServiceTestData.java │ │ │ │ ├── GeneralServiceTestData.java │ │ │ │ └── InfoServiceTestData.java │ │ │ └── tinkerpopconversion │ │ │ │ ├── MetaProperties.java │ │ │ │ ├── MultiLabeledVertex.java │ │ │ │ ├── NonExplicitLabels.java │ │ │ │ ├── SetAndListCardinalities.java │ │ │ │ ├── SimpleGraph.java │ │ │ │ ├── SupportedPropertyValueTypes.java │ │ │ │ ├── TinkerConversionTestCase.java │ │ │ │ └── UnsupportedPropertyValueTypes.java │ │ │ └── tests │ │ │ ├── integration │ │ │ ├── DataServiceClearTest.java │ │ │ ├── DataServiceExportTest.java │ │ │ ├── DataServiceLoadTest.java │ │ │ ├── DataServiceViewTest.java │ │ │ ├── InfoServiceTest.java │ │ │ ├── QueryServiceTest.java │ │ │ └── SettingsServiceTest.java │ │ │ └── unit │ │ │ ├── converting │ │ │ ├── NeptuneCSVConverterTest.java │ │ │ └── TinkerPopConverterTest.java │ │ │ ├── io │ │ │ ├── parsing │ │ │ │ ├── ConfigurationParserTest.java │ │ │ │ ├── LPGParserTest.java │ │ │ │ ├── OGParserTest.java │ │ │ │ └── RDFParserTest.java │ │ │ └── serializing │ │ │ │ ├── LPGSerializerTest.java │ │ │ │ ├── OGSerializerTest.java │ │ │ │ └── RDFSerializerTest.java │ │ │ ├── mapping │ │ │ ├── LPGMapperTest.java │ │ │ └── RDFMapperTest.java │ │ │ ├── misc │ │ │ └── ToStringTests.java │ │ │ ├── querying │ │ │ ├── GremlinQueryingTest.java │ │ │ └── SPARQLQueryingTest.java │ │ │ └── service │ │ │ ├── ClearServiceTest.java │ │ │ ├── ExportServiceTest.java │ │ │ ├── InfoServiceTest.java │ │ │ ├── LoadServiceTest.java │ │ │ ├── QueryServiceTest.java │ │ │ ├── SettingsServiceTest.java │ │ │ └── ViewServiceTest.java │ │ └── resources │ │ └── parserTestDatasets │ │ ├── LPG │ │ ├── LPGMappingConfigurations │ │ │ ├── malformed_lpg_config.json │ │ │ ├── malformed_lpg_config_incorrect_array_size.json │ │ │ ├── normal_lpg_config.json │ │ │ └── not_an_iri_lpg_config.json │ │ ├── NeptuneCSV │ │ │ ├── nCSV_edges_multi_edge.csv │ │ │ ├── nCSV_edges_normal.csv │ │ │ ├── nCSV_malformed.csv │ │ │ ├── nCSV_nodes_bad_date.csv │ │ │ ├── nCSV_nodes_normal.csv │ │ │ └── nCSV_same_prop_names.csv │ │ ├── graphML │ │ │ ├── graphML_malformed.xml │ │ │ └── graphML_normal.xml │ │ └── graphSON │ │ │ ├── graphSON_malformed.json │ │ │ └── graphSON_normal.json │ │ ├── RDF │ │ ├── NTriples │ │ │ └── ntriples_normal.nt │ │ ├── TriG │ │ │ └── trig_normal.trig │ │ ├── Turtle │ │ │ └── turtle_normal.ttl │ │ ├── nQuads │ │ │ └── nquads_normal.nq │ │ └── rdfxml │ │ │ └── rdfxml_normal.rdf │ │ └── oneGraph │ │ ├── literals │ │ ├── og_lit_dataTypes.txt │ │ ├── og_lit_escapedCharacters.txt │ │ ├── og_lit_languageTags.txt │ │ └── og_lit_unicodeEscaped.txt │ │ ├── malformed │ │ ├── og_malformed_iri.txt │ │ ├── og_malformed_literal.txt │ │ ├── og_malformed_literal_2.txt │ │ ├── og_malformed_literal_3.txt │ │ ├── og_malformed_literal_4.txt │ │ ├── og_malformed_literal_5.txt │ │ ├── og_malformed_literal_6.txt │ │ ├── og_missing_sid.txt │ │ ├── og_unexpected_entry.txt │ │ ├── og_unexpected_entry_2.txt │ │ ├── og_unexpected_entry_3.txt │ │ ├── og_unexpected_entry_4.txt │ │ ├── og_unexpected_entry_5.txt │ │ ├── og_unexpected_eol.txt │ │ └── og_unexpected_eol_2.txt │ │ ├── normal │ │ ├── og_normal_1.txt │ │ ├── og_normal_2.txt │ │ └── og_normal_3.txt │ │ └── referenceCycles │ │ ├── og_ref_cycle_complex.txt │ │ ├── og_ref_cycle_self.txt │ │ └── og_ref_cycle_simple.txt ├── README.md └── pom.xml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── amazon-neptune-and-aws-cdk-for-amundsen ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── THIRD-PARTY-LICENSES ├── bin │ └── amundsen-cdk.ts ├── cdk.json ├── data │ ├── amundsen_dw.sql │ └── amundsen_sample.dump ├── images │ └── amazon-neptune-and-aws-cdk-for-amundsen-solution overview.png ├── jest.config.js ├── lib │ ├── amundsen-stack.ts │ ├── bastion-stack.ts │ ├── databuilder-stack.ts │ ├── databuilders │ │ ├── .dockerignore │ │ ├── .gitignore │ │ └── postgres │ │ │ ├── Dockerfile │ │ │ ├── THIRD-PARTY-LICENSES │ │ │ ├── postgres_extract_neptune_publish.py │ │ │ └── requirements.txt │ ├── rds-stack.ts │ ├── redshift-stack.ts │ ├── sample-dbs-stack.ts │ └── vpc-stack.ts ├── package-lock.json ├── package.json ├── test │ └── amundsen-cdk.test.ts └── tsconfig.json ├── gremlin ├── chatbot-full-stack-application │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── cfn-templates │ │ ├── blog-parser.yaml │ │ ├── chatbot.yaml │ │ ├── lexbot-deploy.yaml │ │ └── overall.yaml │ ├── code │ │ ├── lambda-layers │ │ │ ├── Pillow.zip │ │ │ ├── amazonlexbotdeploy-layer.zip │ │ │ ├── blogparser.zip │ │ │ ├── crhelper-layer.zip │ │ │ └── gremlin-python-layer.zip │ │ ├── lambda │ │ │ ├── blog-chatbot-blog-parser.zip │ │ │ ├── blog-chatbot-lex-deploy.zip │ │ │ ├── blog_chatbot_author_validation.zip │ │ │ ├── blog_chatbot_gateway.zip │ │ │ └── chatbot-database-loader.zip │ │ └── web-ui │ │ │ ├── .gitignore │ │ │ └── neptune-chatbot │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── amplify.json │ │ │ ├── amplify │ │ │ ├── .config │ │ │ │ └── project-config.json │ │ │ ├── backend │ │ │ │ ├── auth │ │ │ │ │ └── cognito80d33dbf │ │ │ │ │ │ ├── cognito80d33dbf-cloudformation-template.yml │ │ │ │ │ │ └── parameters.json │ │ │ │ └── backend-config.json │ │ │ └── team-provider-info.json │ │ │ ├── favicon.ico │ │ │ ├── package.json │ │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ ├── logo192.png │ │ │ ├── logo512.png │ │ │ ├── manifest.json │ │ │ └── robots.txt │ │ │ └── src │ │ │ ├── App.css │ │ │ ├── App.js │ │ │ ├── assets │ │ │ ├── blog.ico │ │ │ ├── logo.png │ │ │ └── person.ico │ │ │ ├── components │ │ │ ├── Chart.js │ │ │ ├── Chatbot.js │ │ │ └── Layout.js │ │ │ ├── config.json │ │ │ ├── index.css │ │ │ ├── index.js │ │ │ ├── logo.svg │ │ │ └── serviceWorker.js │ └── deployment │ │ ├── .gitignore │ │ ├── deploy.py │ │ └── run.sh ├── collaborative-filtering │ ├── README.md │ ├── data │ │ ├── edges.txt │ │ └── vertex.txt │ └── images │ │ ├── cloudformation-launch-stack.png │ │ └── image1.jpg ├── etl-from-relational-model │ ├── README.md │ └── images │ │ ├── athena-appearedinedges.png │ │ ├── athena-databasetables.png │ │ ├── athena-homescreen.png │ │ ├── athena-namesnodes.png │ │ ├── athena-outputfiles.png │ │ ├── athena-querytabs.png │ │ ├── athena-tablepreview.png │ │ ├── athena-tablepreviewresults.png │ │ ├── athena-titlenodes.png │ │ ├── datamodel-erp.png │ │ ├── datamodel-relational.png │ │ ├── glue-addcrawler.png │ │ ├── glue-crawlerbucket.png │ │ ├── glue-crawlerdatabase.png │ │ ├── glue-crawleriam.png │ │ ├── glue-crawlerrun.png │ │ ├── glue-crawlerschedule.png │ │ ├── glue-datagenericheaders.png │ │ ├── glue-datatables.png │ │ ├── glue-editheaders.png │ │ ├── glue-fixedheaders.png │ │ ├── neptune-clusterendpoint.png │ │ ├── neptune-clusters.png │ │ ├── neptune-menu.png │ │ └── neptune-menuexp.png ├── glue-neptune │ ├── LICENSE │ ├── README.md │ ├── cloudformation-templates │ │ ├── databases-aurora-mysql-stack.json │ │ ├── databases-neptune-stack.json │ │ ├── glue-neptune-stack.json │ │ ├── glue-stack.json │ │ ├── iam-glue-assume-role-stack.json │ │ ├── iam-glue-stack.json │ │ ├── iam-neptune-stack.json │ │ ├── iam-rds-stack.json │ │ ├── iam-sagemaker-stack.json │ │ ├── sagemaker-stack.json │ │ ├── test-glue-neptune-stack.json │ │ ├── vpc-neptune-stack.json │ │ ├── vpc-rds-stack.json │ │ ├── vpc-sagemaker-stack.json │ │ └── vpc-stack.json │ ├── glue-jobs │ │ ├── common │ │ │ └── load_mysql.py │ │ └── mysql-neptune │ │ │ ├── export-from-mysql-to-neptune-incremental.py │ │ │ ├── export-from-mysql-to-neptune.py │ │ │ └── export-from-mysql-to-s3.py │ ├── glue-neptune-architecture.png │ ├── mysql-2-neptune-01.png │ ├── mysql-2-neptune-02.png │ ├── mysql-2-neptune-03.png │ └── notebooks │ │ ├── Introduction.ipynb │ │ ├── LICENSE │ │ ├── glue_utils.py │ │ ├── step-1--load-mysql.ipynb │ │ ├── step-2--export-to-neptune-via-s3.ipynb │ │ ├── step-2-alt--import-from-mysql.ipynb │ │ └── step-3--incremental-import-from-mysql-to-neptune.ipynb ├── gremlin-java-client-demo │ ├── LICENSE.txt │ ├── pom.xml │ ├── readme.md │ └── src │ │ └── main │ │ └── java │ │ ├── com │ │ └── amazonaws │ │ │ └── services │ │ │ └── neptune │ │ │ └── GremlinClientDemo.java │ │ └── org │ │ └── apache │ │ └── tinkerpop │ │ └── gremlin │ │ └── driver │ │ ├── HandshakeRequestConfig.java │ │ ├── LBAwareAwsSigV4ClientHandshaker.java │ │ ├── LBAwareSigV4WebSocketChannelizer.java │ │ └── NeptuneClusterBuilder.java ├── gremlin-node.js-client-demo │ └── node.js-gremlin.ipynb ├── neptune-gremlin-client-demo │ ├── cloudformation-templates │ │ ├── neptune-gremlin-client-demo.json │ │ └── neptune-gremlin-client-lambda.json │ └── notebooks │ │ ├── force-failover.ipynb │ │ ├── setup.ipynb │ │ └── using-gremlin-client-in-a-lambda.ipynb ├── neptune-social-media-utils │ ├── LICENSE │ ├── README.md │ ├── conf │ │ └── batch_import.properties │ ├── csv-conf │ │ ├── large_config.json │ │ ├── medium_config.json │ │ ├── rich │ │ │ ├── large-csv │ │ │ │ ├── large_config-100x.json │ │ │ │ ├── large_config-10x.json │ │ │ │ ├── large_config-50x.json │ │ │ │ └── large_config.json │ │ │ └── med-csv │ │ │ │ ├── medium_config_100x-prop.json │ │ │ │ ├── medium_config_10x-prop.json │ │ │ │ └── medium_config_50x-prop.json │ │ ├── small_config.json │ │ ├── supernode_config.json │ │ ├── tiny_config.json │ │ └── twitter-like-w-date.json │ ├── doc │ │ └── source │ │ │ └── images │ │ │ ├── architecture.png │ │ │ └── sample_output.png │ ├── pom.xml │ ├── run.sh │ ├── samples │ │ ├── date-helper.groovy │ │ └── twitter-like-queries.txt │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── aws │ │ └── neptune │ │ ├── Main.java │ │ └── utils │ │ ├── bulkloader │ │ └── BulkLoadData.java │ │ ├── generator │ │ ├── CSVGenerator.java │ │ ├── GSONUtil.java │ │ ├── IdStore.java │ │ ├── NeptuneGraphBench.java │ │ └── bean │ │ │ ├── BatchImporterDataMap.java │ │ │ ├── CSVConfig.java │ │ │ ├── CSVIdBean.java │ │ │ ├── ColumnBean.java │ │ │ ├── EdgeLabelBean.java │ │ │ ├── EdgeMapBean.java │ │ │ ├── EdgeTypeBean.java │ │ │ ├── GSONSchema.java │ │ │ ├── IndexBean.java │ │ │ ├── PropertyKeyBean.java │ │ │ ├── RelationBean.java │ │ │ ├── VertexCentricIndexBean.java │ │ │ ├── VertexLabelBean.java │ │ │ ├── VertexMapBean.java │ │ │ └── VertexTypeBean.java │ │ └── s3uploader │ │ └── S3Uploader.java ├── neptune-streams │ ├── LICENSE.txt │ ├── cloudformation-templates │ │ ├── iam-stack.json │ │ ├── neptune-streams-base-stack.json │ │ ├── network-stack.json │ │ ├── services-elasticache-stack.json │ │ ├── services-lambda-stack.json │ │ ├── services-neptune-stack.json │ │ └── services-sagemaker-stack.json │ ├── lambda │ │ ├── build.sh │ │ └── neptune-streams-demo │ │ │ ├── build.sh │ │ │ ├── neptune_python_utils.zip │ │ │ ├── neptune_stream_handler.py │ │ │ ├── neptune_workload.py │ │ │ └── neptune_workload_manager.py │ └── notebooks │ │ ├── centrality-counts.ipynb │ │ └── stream-viewer.ipynb ├── ogma-neptune │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── cloudfront-create-distribution-config.txt │ ├── error.html │ ├── images │ │ ├── architecture.png │ │ └── image.png │ ├── index.html │ ├── indexLambda.js │ ├── package-lock.json │ ├── package.json │ ├── rollup.config.js │ ├── sampledata │ │ ├── Tweet.csv │ │ ├── Tweet_Mentions_User_edges.csv │ │ ├── User.csv │ │ ├── User_Follows_User_edges.csv │ │ ├── User_Likes_Tweet_edges.csv │ │ ├── User_Retweets_Tweet_edges.csv │ │ └── User_Tweets_Tweet_edges.csv │ ├── src │ │ ├── api.js │ │ ├── index.js │ │ └── ui.js │ └── styles.css ├── property-graph-data-modelling │ ├── LICENSE │ ├── README.md │ ├── html │ │ ├── 00-introduction.html │ │ ├── data-model-1.html │ │ ├── data-model-2.html │ │ └── data-model-3.html │ └── notebooks │ │ ├── 00-introduction.ipynb │ │ ├── data-model-1.ipynb │ │ ├── data-model-2.ipynb │ │ └── data-model-3.ipynb ├── stream-2-neptune │ ├── LICENSE │ ├── README.md │ ├── cloudformation-templates │ │ ├── dashboard.json │ │ ├── ec2-workload.json │ │ ├── stream-2-neptune-stack.json │ │ └── stream-and-lambda-writers.json │ ├── kinesis-2-neptune-architecture.png │ ├── load-neptune.png │ ├── metrics.png │ ├── notebooks │ │ ├── load-social-data.ipynb │ │ └── social-network-queries.ipynb │ ├── query-neptune.png │ ├── run-workload.png │ ├── social-app-driver │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── amazonaws │ │ │ └── services │ │ │ └── neptune │ │ │ └── examples │ │ │ └── social │ │ │ ├── SocialAppDriver.java │ │ │ ├── tasks │ │ │ ├── AddEdgesTask.java │ │ │ ├── AddEdgesTaskMulithreaded.java │ │ │ ├── EdgeInfo.java │ │ │ └── KinesisClient.java │ │ │ └── util │ │ │ └── ActivityTimer.java │ └── social-app-neptune-writer │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── amazonaws │ │ │ └── services │ │ │ └── neptune │ │ │ └── examples │ │ │ ├── social │ │ │ ├── AddBatchEdgesQuery.java │ │ │ ├── Batch.java │ │ │ ├── Batches.java │ │ │ └── SocialAppNeptuneWriterStreamHandler.java │ │ │ └── utils │ │ │ ├── ActivityTimer.java │ │ │ ├── ConnectionConfig.java │ │ │ ├── EnvironmentVariableUtils.java │ │ │ ├── Metrics.java │ │ │ ├── Parameters.java │ │ │ ├── RetryClient.java │ │ │ ├── RetryCondition.java │ │ │ └── TraversalSource.java │ │ └── resources │ │ └── log4j2.xml └── visjs-neptune │ ├── LICENSE │ ├── README.md │ ├── images │ ├── architecture.png │ └── visualization.png │ ├── indexLambda.js │ ├── package.json │ ├── sampledata │ ├── Tweet.csv │ ├── Tweet_Mentions_User_edges.csv │ ├── User.csv │ ├── User_Follows_User_edges.csv │ ├── User_Likes_Tweet_edges.csv │ ├── User_Retweets_Tweet_edges.csv │ └── User_Tweets_Tweet_edges.csv │ ├── vis-network.min.css │ ├── vis.js │ ├── visualization-error.html │ └── visualize-graph.html ├── investment-analysis-on-edgar-using-vss ├── README.md ├── edgar_data_pipeline │ ├── S3_utils.py │ ├── bedrock_api.py │ ├── edgar_data_processor.py │ └── embed_holder_node_descriptions.py ├── edgar_frontend │ ├── investment_analysis_interface.py │ └── knowledge_graph_updater.py ├── neptune_analytics_integration │ └── vss_integration.py ├── requirements.txt └── settings.py ├── neptune-locust ├── .gitignore ├── LICENSE ├── README.md ├── __init__.py ├── examples │ ├── bolt_locustfile.py │ ├── gremlindriver_locustfile.py │ ├── neptuneuser_gremlin_locustfile.py │ └── neptuneuser_oc_locustfile.py ├── neptune_locust │ ├── __init__.py │ └── users │ │ ├── BoltUser.py │ │ ├── GremlinDriverUser.py │ │ ├── NeptuneBoltAuthToken.py │ │ ├── NeptuneUser.py │ │ └── __init__.py ├── pyproject.toml └── requirements.txt ├── neptune-sagemaker ├── LICENSE.txt ├── README.md ├── cdk │ └── python │ │ └── neptune-notebook │ │ ├── .gitignore │ │ ├── README.md │ │ ├── app.py │ │ ├── cdk.json │ │ ├── neptune_notebook │ │ ├── __init__.py │ │ └── neptune_notebook_stack.py │ │ └── requirements.txt ├── cloudformation-templates │ ├── common │ │ └── add-iam-role-to-neptune.json │ ├── neptune-sagemaker │ │ ├── neptune-sagemaker-base-stack.json │ │ └── neptune-sagemaker-nested-stack.json │ └── neptune-workbench │ │ ├── LICENSE │ │ ├── README.md │ │ └── neptune-workbench-stack.yaml ├── images │ ├── 02-edge-properties.png │ ├── 02-edge.png │ ├── 02-example-graph.png │ ├── 02-multiple-labels.png │ ├── 02-self-edge.png │ ├── 02-vertex.png │ └── 03-social-network.png ├── lambda │ └── add-iam-role-to-neptune.py ├── notebooks │ ├── Getting-Started │ │ ├── 01-Introduction.ipynb │ │ ├── 02-Labelled-Property-Graph.ipynb │ │ └── 03-Social-Network-Recommendations.ipynb │ ├── Let-Me-Graph-That-For-You │ │ └── 01-Air-Routes.ipynb │ ├── edgar │ │ ├── .ipynb_checkpoints │ │ │ └── 01-edar-checkpoint.ipynb │ │ ├── 01-edar.ipynb │ │ ├── security.csv │ │ ├── securityholdr.csv │ │ └── srelations.csv │ └── util │ │ ├── Update-Content.ipynb │ │ ├── content.py │ │ ├── neptune.py │ │ └── visualisation.py └── scripts │ └── create-sync-notebook-script.sh ├── neptune-workbench-cloudformation ├── LICENSE ├── README.md └── neptune-workbench-stack.yaml ├── opencypher └── Cheatsheet.md └── pg-schema-for-rdf ├── .gitignore ├── README.md ├── requirements.txt ├── src ├── pgschema.py └── rdfpgschema.py └── test ├── demo.py └── tests.py /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | *Issue #, if available:* 2 | 3 | *Description of changes:* 4 | 5 | 6 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/java/software/amazon/neptune/onegraph/playground/client/Neptune1GPlaygroundCLIApplication.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.client; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Neptune1GPlaygroundCLIApplication { 8 | public static void main(String[] args) { 9 | SpringApplication.run(Neptune1GPlaygroundCLIApplication.class, args); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/java/software/amazon/neptune/onegraph/playground/client/api/QueryType.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.client.api; 2 | 3 | /** 4 | * Queries are either SPARQL or Gremlin. 5 | */ 6 | public enum QueryType { 7 | 8 | SPARQL, 9 | GREMLIN; 10 | 11 | /** 12 | * Creates a query type from the given arguments 13 | * @param sparql True if this query is a SPARQL query. 14 | * @param gremlin True if this query is a Gremlin query. 15 | * @return The query type according to the given arguments 16 | * @throws IllegalArgumentException When both {@code sparql} and {@code gremlin} are true or when both are false. 17 | */ 18 | public static QueryType queryTypeFromCLIArguments(boolean sparql, boolean gremlin) throws IllegalArgumentException { 19 | if ((sparql && gremlin) || (!sparql && !gremlin)) { 20 | throw new IllegalArgumentException("Incorrect amount of flags: please pass exactly 1 query type flag"); 21 | } 22 | if (sparql) { 23 | return SPARQL; 24 | } else { 25 | return GREMLIN; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/java/software/amazon/neptune/onegraph/playground/client/request/LoadRequest.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.client.request; 2 | 3 | import lombok.NonNull; 4 | import software.amazon.neptune.onegraph.playground.client.api.DataFormat; 5 | 6 | /** 7 | * Expected content of the POST to /data. 8 | */ 9 | public class LoadRequest extends Request { 10 | 11 | /** 12 | * Path to the file to load. 13 | */ 14 | public String path1; 15 | 16 | /** 17 | * Path to the second file to load, this should only be set if the {@link #dataFormat} is {@code NEPTUNECSV}. 18 | */ 19 | public String path2; 20 | 21 | /** 22 | * The data format of the file to load. 23 | */ 24 | public DataFormat dataFormat; 25 | 26 | /** 27 | * Creates a new load request with the given parameters. 28 | * @param dataFormat Used to set the {@link LoadRequest#dataFormat}. 29 | * @param path1 Used to set the {@link LoadRequest#path1}. 30 | * @param path2 Used to set the {@link LoadRequest#path2, can be{@code null}. 31 | */ 32 | public LoadRequest(@NonNull DataFormat dataFormat, 33 | @NonNull String path1, 34 | String path2) { 35 | this.dataFormat = dataFormat; 36 | this.path1 = path1; 37 | if (path2 != null && path2.length() != 0) { 38 | this.path2 = path2; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/java/software/amazon/neptune/onegraph/playground/client/request/Request.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.client.request; 2 | 3 | /** 4 | * Abstract superclass of all requests. 5 | */ 6 | public abstract class Request { 7 | } 8 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/java/software/amazon/neptune/onegraph/playground/client/response/InfoResponse.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.client.response; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | /** 7 | * Response format for GET requests to /info. 8 | */ 9 | public class InfoResponse { 10 | 11 | public InfoResponse() {} 12 | 13 | /** 14 | * String containing the current data stored server-side in OneGraph data format. 15 | */ 16 | public String serializedOG; 17 | 18 | /** 19 | * Contains the line numbers of the lines that are deemed RDF non-compatible of the {@link InfoResponse#serializedOG}. 20 | */ 21 | public Set rdfNonCompatibleLines = new HashSet<>(); 22 | 23 | /** 24 | * Contains the line numbers of the lines that are deemed LPG non-compatible of the {@link InfoResponse#serializedOG}. 25 | */ 26 | public Set lpgNonCompatibleLines = new HashSet<>(); 27 | 28 | /** 29 | * Contains the line numbers of the lines that are deemed RDF pairwise non-compatible of the {@link InfoResponse#serializedOG}. 30 | */ 31 | public Set pairwiseNonCompatibleLines = new HashSet<>(); 32 | } 33 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/java/software/amazon/neptune/onegraph/playground/client/response/QueryResponseType.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.client.response; 2 | 3 | /** 4 | * Specifies the type of the {@link QueryResponse}. 5 | */ 6 | public enum QueryResponseType { 7 | 8 | /** 9 | * The query response was of a Gremlin traversal. 10 | */ 11 | GREMLINTRAVERSAL, 12 | 13 | /** 14 | * The query response was of a SPARQL CONSTRUCT query. 15 | */ 16 | SPARQLGRAPH, 17 | 18 | /** 19 | * The query response was of a SPARQL SELECT query. 20 | */ 21 | SPARQLTUPLE, 22 | 23 | /** 24 | * The query response was of a SPARQL ASK query. 25 | */ 26 | SPARQLBOOLEAN; 27 | } 28 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/java/software/amazon/neptune/onegraph/playground/client/response/SettingsResponse.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.client.response; 2 | 3 | import software.amazon.neptune.onegraph.playground.client.api.ConfigType; 4 | 5 | /** 6 | * Response format for GET requests to /settings. 7 | */ 8 | public class SettingsResponse { 9 | 10 | public SettingsResponse() {} 11 | 12 | /** 13 | * The type of LPG mapping configuration currently in the settings. 14 | */ 15 | public ConfigType configType; 16 | 17 | /** 18 | * The query timeout in milliseconds currently in the settings. 19 | */ 20 | public Long timeoutMillis; 21 | 22 | /** 23 | * True if the LPG mapping configuration currently in the settings is reversible. 24 | */ 25 | public Boolean reversible; 26 | 27 | /** 28 | * The path the custom LPG mapping configuration was loaded from. 29 | */ 30 | public String pathToConfig; 31 | } 32 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/java/software/amazon/neptune/onegraph/playground/client/service/ServiceException.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.client.service; 2 | 3 | /** 4 | * Exceptions that occur during operations of any {@code Service} are thrown as {@link ServiceException}, 5 | * the message is displayed directly to the user. 6 | */ 7 | public class ServiceException extends RuntimeException { 8 | private static final String causeLiteral = "CAUSE: "; 9 | private static final String errorMessage = "An error occurred while executing the %s command, %s"; 10 | 11 | /** 12 | * Create a new exception with a message for the user indicating what went wrong. 13 | * @param commandRan Which command was running when the error occurred. 14 | * @param cause The cause of the error. 15 | */ 16 | public ServiceException(String commandRan, Throwable cause) { 17 | super(String.format(errorMessage, commandRan, getCausesChain(cause)), cause); 18 | } 19 | 20 | // Collects the messages of all causes in a single string. 21 | private static String getCausesChain(Throwable cause) { 22 | StringBuilder causes = new StringBuilder(); 23 | causes.append(causeLiteral).append(cause.getMessage()).append("\n"); 24 | 25 | for (Throwable t = cause.getCause(); t != null; t = t.getCause()) { 26 | causes.append(causeLiteral).append(t.getMessage()).append("\n"); 27 | } 28 | return causes.toString(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/endpoints.properties: -------------------------------------------------------------------------------- 1 | baseURL=http://localhost:8080/ 2 | dataEndpoint=data 3 | exportEndpoint=data/export 4 | settingsEndpoint=settings 5 | infoEndpoint=info 6 | sparqlEndpoint=query/sparql 7 | gremlinEndpoint=query/gremlin 8 | 9 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/conclusion.txt: -------------------------------------------------------------------------------- 1 | Recap: We have seen how to use the \u001b[1mload\u001b[0m, \u001b[1mview\u001b[0m and \u001b[1mclear-data\u001b[0m commands. 2 | 3 | - The \u001b[1mload\u001b[0m command allows us to load RDF or property graph data into the tool, 4 | it is important to note that data loading is additive, this allows several 5 | datasets to be loaded on top of each other. 6 | - The \u001b[1mview\u001b[0m command allows us to view what data is currently loaded. 7 | - The \u001b[1mclear-data\u001b[0m command clears all data previously loaded. 8 | 9 | To learn more about the OneGraph data model, please take scenario 2. -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/data/scenario1NTriples.nt: -------------------------------------------------------------------------------- 1 | . 2 | "25"^^ . 3 | "1.72"^^ . 4 | "Alice" . 5 | . 6 | "Bob" . 7 | "28"^^ . -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/data/scenario1NeptuneCSV_edges.csv: -------------------------------------------------------------------------------- 1 | ~id,~from,~to,~label 2 | 1,A,B,knows -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/data/scenario1NeptuneCSV_nodes.csv: -------------------------------------------------------------------------------- 1 | ~id,~label,name:String,age:Int,weight:Float 2 | A,Person,Alice,25,170.6 3 | B,Person,Bob,28,197.9 -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/steps/step1.txt: -------------------------------------------------------------------------------- 1 | Let's load the following N-Triples file into the tool; -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/steps/step2.txt: -------------------------------------------------------------------------------- 1 | We can achieve this using the \u001b[1mload\u001b[0m command. 2 | The load command has a required flag \u001b[1m-t\u001b[0m, specifying the format of the data to load. 3 | It can take one of the following values: 4 | 5 | \u001b[1mntriples, nquads, rdfxml, turtle, trig, neptunecsv, graphml, graphson, og.\u001b[0m 6 | 7 | After that, \u001b[1mload\u001b[0m takes up to two additional parameters, specifying the path to the file(s) to load. 8 | Let's run the following command to load the data: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/steps/step3.txt: -------------------------------------------------------------------------------- 1 | The data is now loaded and stored on the server component of the playground. 2 | We can view what data is currently stored on the server at any time using the \u001b[1mview\u001b[0m command. 3 | The \u001b[1mview\u001b[0m command takes a \u001b[1m-t\u001b[0m parameter just like \u001b[1mload\u001b[0m, specifying the format the user wants to view the data in. 4 | Let's run the following command to view the data: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/steps/step4.txt: -------------------------------------------------------------------------------- 1 | Although we originally loaded N-Triples data, we can view the data stored 2 | on the server in any of the supported data formats. 3 | Let's run the following command to view the data in Turtle: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/steps/step5.txt: -------------------------------------------------------------------------------- 1 | Now that we have loaded and viewed some RDF data in the tool, let's try to load 2 | a property graph. First, let's clear the data currently stored on the server. 3 | We can achieve this with the \u001b[1mclear-data\u001b[0m command: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/steps/step6.txt: -------------------------------------------------------------------------------- 1 | Now, let's load the following property graph into the tool, in Neptune CSV format; -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/steps/step7.txt: -------------------------------------------------------------------------------- 1 | We can achieve this by running the following command: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/steps/step8.txt: -------------------------------------------------------------------------------- 1 | To achieve interoperability between RDF and LPG data, all data loaded 2 | into to the tool is converted into the overarching OneGraph data model. 3 | 4 | Hence, the property graph we just loaded is not represented as a property 5 | graph internally. When the \u001b[1mview\u001b[0m command is run, the data is converted 6 | from the internal OneGraph representation to the specified RDF or LPG 7 | format on the fly. 8 | 9 | This allows us to \u001b[1mview\u001b[0m the data currently loaded in an RDF format, even though 10 | the data was originally loaded as a property graph. Let's run the following 11 | command to view the current data in N-Quads: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/steps/step9.txt: -------------------------------------------------------------------------------- 1 | We will discuss the OneGraph data model in more detail in the next scenario. 2 | The data loaded currently in the tool can also be exported to disk. For this you 3 | can use the following command (but we will not run it now): -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario1/welcome.txt: -------------------------------------------------------------------------------- 1 | Welcome to scenario 1. 2 | 3 | This scenario will show you how to \u001b[1mload\u001b[0m, \u001b[1mview\u001b[0m and \u001b[1mclear\u001b[0m data in the tool. 4 | The 1GPlayground allows data to be loaded in several data formats. This includes: 5 | 6 | - RDF/XML, NTriples, NQuads, Turtle, and TriG for RDF data. 7 | - Neptune CSV, GraphSON, and GraphML for Labeled Property Graph(LPG) data. 8 | - A custom 'OneGraph' data format. 9 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/conclusion.txt: -------------------------------------------------------------------------------- 1 | Recap: We have been introduced to the idea of OneGraph and have 2 | seen that a 1G data set is made up of 5 elements: 3 | 4 | - relationship, property, and membership statements. 5 | - simple nodes. 6 | - graphs. 7 | 8 | Finally, we have seen how to view this internal representation using the 9 | \u001b[1mview -t formal\u001b[0m and \u001b[1mview -t og\u001b[0m commands. 10 | 11 | To learn about cross-model querying, take scenario 3. -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/data/scenario2NeptuneCSV_edges.csv: -------------------------------------------------------------------------------- 1 | ~id,~from,~to,~label -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/data/scenario2NeptuneCSV_nodes.csv: -------------------------------------------------------------------------------- 1 | ~id,~label,weight:Float 2 | A,Boss,170.6 -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/data/scenario2Turtle.ttl: -------------------------------------------------------------------------------- 1 | @prefix rel: . 2 | @prefix prop: . 3 | @prefix label: . 4 | @prefix id: . 5 | 6 | id:A 7 | a label:Person ; 8 | prop:age "44"^^ ; 9 | prop:name "Alice" ; 10 | rel:knows id:B . 11 | id:B 12 | a label:Person ; 13 | prop:name "Bob" . -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/steps/step1.txt: -------------------------------------------------------------------------------- 1 | As previously mentioned, data loaded into the tool gets 2 | converted into the OneGraph(1G) data format. OneGraph is an overarching 3 | data model for both RDF data and property graphs(LPG). Any RDF or LPG 4 | data can be converted into OneGraph without loss of information. 5 | 6 | Although conversion to 1G from RDF or LPG is always lossless, not every 1G 7 | data set can be converted without loss of information in the opposite 8 | direction. We will explore this in more detail in scenario 4. -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/steps/step10.txt: -------------------------------------------------------------------------------- 1 | P.S Data in the OneGraph serialization format can also be 2 | exported and loaded by passing the \u001b[1mog\u001b[0m value for the \u001b[1m-t\u001b[0m parameter. -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/steps/step2.txt: -------------------------------------------------------------------------------- 1 | The 1G data model consists of so-called statements, simple nodes, and 2 | graphs. We call these 3 building blocks 1g elements. With these, 3 | any LPG or RDF data can be represented. 4 | 5 | - Statements: statements in 1G come in 3 different forms: 6 | - Relationship statements: These statements signify a relation 7 | between 2 other elements with an accompanying predicate. 8 | RDF statements with a resource in object position, and edges 9 | in LPG are represented in 1G as such statements. 10 | 11 | - Property statements: These statements allow elements to carry 12 | named values. RDF statements with a literal in object position, and 13 | properties on vertices and edges in LPG are represented in 1G using such 14 | statements. 15 | 16 | - Membership statements: These statements specify graph membership of 17 | relationship and property statements. This allows graph membership of 18 | RDF statements to be modeled this way. -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/steps/step3.txt: -------------------------------------------------------------------------------- 1 | Finally, there are simple nodes and graphs: 2 | 3 | - Simple nodes: These represent basic elements from LPG or RDF. 4 | This includes: IRIs and Blank Nodes from RDF, and vertices 5 | from LPG. 6 | 7 | - Graphs: These are similar to RDF Graphs. They appear in 8 | membership statements, but can also appear in 9 | relationship or property statements. -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/steps/step4.txt: -------------------------------------------------------------------------------- 1 | To view the internal OneGraph representation of the data, we can specify 2 | the value \u001b[1mformal\u001b[0m for the \u001b[1m-t\u001b[0m flag of the view command. 3 | 4 | First let's load the following Turtle into the tool; -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/steps/step5.txt: -------------------------------------------------------------------------------- 1 | Remember that we can achieve this using the following command: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/steps/step6.txt: -------------------------------------------------------------------------------- 1 | Now, let's view the OneGraph representation using the following command: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/steps/step7.txt: -------------------------------------------------------------------------------- 1 | Now, let's load the following property graph consisting of a 2 | single node additively to the current data in the tool; -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/steps/step8.txt: -------------------------------------------------------------------------------- 1 | Now let's look at the formal representation again using: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/steps/step9.txt: -------------------------------------------------------------------------------- 1 | As you can see, the RDF data set and property graph are now 2 | both contained within the same OneGraph data set. The property names and 3 | labels from the property graph are prefixed by a default IRI, we will 4 | explore this in more detail in scenario 5. 5 | 6 | Finally, let's use the \u001b[1mview -t og\u001b[0m command to examine the data 7 | in the OneGraph serialization format. This format will make it 8 | easier to interpret the data. -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario2/welcome.txt: -------------------------------------------------------------------------------- 1 | Welcome to scenario 2. 2 | 3 | In this scenario the OneGraph data model will be explained in more detail. 4 | We will take a look at how data is represented internally after it has been loaded. 5 | 6 | The \u001b[1m-t\u001b[0m parameter values of \u001b[1mformal\u001b[0m and \u001b[1mog\u001b[0m will be introduced for the \u001b[1mload\u001b[0m, \u001b[1mview\u001b[0m, 7 | and \u001b[1mexport\u001b[0m commands, specifying the formal or serialized OneGraph representations, 8 | respectively. -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/conclusion.txt: -------------------------------------------------------------------------------- 1 | Recap: We have been introduced to the idea of cross-model querying 2 | and have issued both SPARQL and Gremlin queries on the same data set. 3 | Finally, we learned that the \u001b[1mquery\u001b[0m command takes one of 4 different forms: 4 | 5 | - \u001b[1mquery -gremlin "g.V()"\u001b[0m 6 | - \u001b[1mquery -sparql "SELECT ?s ?p ?o WHERE { ?s ?p ?o }"\u001b[0m 7 | - \u001b[1mquery -gremlin -f \u001b[0m 8 | - \u001b[1mquery -sparql -f \u001b[0m -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/data/scenario3NeptuneCSV_edges.csv: -------------------------------------------------------------------------------- 1 | ~id,~from,~to,~label 2 | 1,A,C,owns -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/data/scenario3NeptuneCSV_nodes.csv: -------------------------------------------------------------------------------- 1 | ~id,~label,weight:Float 2 | A,Person,170.6 3 | C,Car,4000 -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/data/scenario3Turtle.ttl: -------------------------------------------------------------------------------- 1 | @prefix rel: . 2 | @prefix prop: . 3 | @prefix label: . 4 | @prefix id: . 5 | @prefix rdf: . 6 | 7 | id:A 8 | a label:Person ; 9 | prop:age "44"^^ ; 10 | prop:name "Alice" ; 11 | rel:owns id:B . 12 | id:B 13 | a label:House . -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/queries/gremlin.txt: -------------------------------------------------------------------------------- 1 | g.V().valueMap(true) -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/queries/sparql_ask.rq: -------------------------------------------------------------------------------- 1 | PREFIX prop: 2 | 3 | ASK { ?x prop:age "44" } -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/queries/sparql_construct.rq: -------------------------------------------------------------------------------- 1 | CONSTRUCT { ?s ?p ?o } Where { ?s ?p ?o } -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/queries/sparql_select.rq: -------------------------------------------------------------------------------- 1 | PREFIX rel: 2 | PREFIX rdf: 3 | PREFIX label: 4 | 5 | SELECT ?s ?t 6 | WHERE { 7 | ?s rdf:type label:Person . 8 | ?s rel:owns ?o . 9 | ?o rdf:type ?t . 10 | } -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/steps/step1.txt: -------------------------------------------------------------------------------- 1 | Let's load the following RDF Turtle data about a person 2 | named Alice who owns a house; -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/steps/step2.txt: -------------------------------------------------------------------------------- 1 | We can use the \u001b[1mquery\u001b[0m command to query the data. 2 | The \u001b[1mquery\u001b[0m command takes either the \u001b[1m-gremlin\u001b[0m or \u001b[1m-sparql\u001b[0m flag, passing either 3 | the query or a file pointing to the query as a parameter. For example: 4 | 5 | - \u001b[1mquery -gremlin "g.V()"\u001b[0m 6 | - \u001b[1mquery -sparql "SELECT ?s ?p ?o WHERE { ?s ?p ?o }"\u001b[0m 7 | - \u001b[1mquery -gremlin -f \u001b[0m 8 | - \u001b[1mquery -sparql -f \u001b[0m 9 | 10 | Note that queries that update the current data, such as SPARQL UPDATE, are 11 | not supported. -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/steps/step3.txt: -------------------------------------------------------------------------------- 1 | Let's issue the following SPARQL SELECT query on the data that selects the 2 | type of things that Alice owns: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/steps/step4.txt: -------------------------------------------------------------------------------- 1 | Let's issue a SPARQL CONSTRUCT query that constructs the entire data set 2 | by running the following command: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/steps/step5.txt: -------------------------------------------------------------------------------- 1 | Finally, let's issue a SPARQL ASK query to find out if Alice is 39 years old 2 | by running the following command: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/steps/step6.txt: -------------------------------------------------------------------------------- 1 | Remember that we originally loaded a Turtle data set. Now lets issue 2 | a Gremlin query against the data: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/steps/step7.txt: -------------------------------------------------------------------------------- 1 | Queries are not ran on the OneGraph data directly; the derivative 2 | RDF and LPG data is obtained from the OneGraph every time new data 3 | is loaded. These derivative data sets are then used to query against. 4 | 5 | Thus, to understand the Gremlin query output a little better, it helps 6 | to view what data it was actually executed on, which we can obtain by 7 | simply running: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/steps/step8.txt: -------------------------------------------------------------------------------- 1 | Now let's load the following property graph on top of the existing data that 2 | lets Alice own more stuff: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/steps/step9.txt: -------------------------------------------------------------------------------- 1 | We can now use the same SPARQL select query we ran earlier to 2 | obtain new information from the property graph we added: -------------------------------------------------------------------------------- /1g-playground/1g-playground-cli/src/main/resources/scenario3/welcome.txt: -------------------------------------------------------------------------------- 1 | Welcome to scenario 3. 2 | 3 | In this scenario we will explore cross-model querying using the query command. 4 | The playground supports the following queries: 5 | 6 | - Gremlin traversals such as g.V() 7 | - SPARQL SELECT, ASK and, CONSTRUCT queries. 8 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/Neptune1GPlaygroundServerApplication.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | 7 | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) 8 | public class Neptune1GPlaygroundServerApplication { 9 | public static void main(String[] args) { 10 | SpringApplication.run(Neptune1GPlaygroundServerApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/api/controller/InfoController.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.api.controller; 2 | 3 | import software.amazon.neptune.onegraph.playground.server.api.response.InfoResponse; 4 | import software.amazon.neptune.onegraph.playground.server.servicespring.InfoServiceSpring; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.RestController; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import software.amazon.neptune.onegraph.playground.server.state.State; 10 | 11 | /** 12 | * REST controller for the info command. 13 | */ 14 | @RestController 15 | @RequestMapping("/info") 16 | public class InfoController { 17 | 18 | private final InfoServiceSpring infoService; 19 | 20 | @Autowired 21 | public InfoController(InfoServiceSpring is) { 22 | this.infoService = is; 23 | } 24 | 25 | /** 26 | * Callback for GET requests to the /info path, provides info about the current data in the 27 | * {@link State} to the client. 28 | */ 29 | @GetMapping 30 | public InfoResponse info() { 31 | return this.infoService.getInfo(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/api/request/LoadRequest.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.api.request; 2 | 3 | 4 | /** 5 | * Request format of client for load command. 6 | */ 7 | public class LoadRequest { 8 | 9 | public LoadRequest() {} 10 | 11 | /** 12 | * Path to the file to load data from. 13 | */ 14 | public String path1; 15 | 16 | /** 17 | * Path to the second file to load, this should only be applied if the {@link #dataFormat} is {@code NEPTUNECSV}, 18 | * can be {@code null}. 19 | */ 20 | public String path2; 21 | 22 | /** 23 | * The data format of the file to load. 24 | */ 25 | public DataFormat dataFormat; 26 | } 27 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/api/request/SettingsRequest.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.api.request; 2 | 3 | /** 4 | * Request format of client for settings command. 5 | */ 6 | public class SettingsRequest { 7 | 8 | public SettingsRequest() {} 9 | 10 | /** 11 | * Path to the configuration file, is only passed when {@link #configType} is set to {@code CUSTOM}. 12 | * can be {@code null}. 13 | */ 14 | public String pathConfig; 15 | 16 | /** 17 | * The type of configuration being loaded, can be {@code null}. 18 | */ 19 | public ConfigType configType; 20 | 21 | /** 22 | * The query timeout in milliseconds, can be {@code null}. 23 | */ 24 | public Long timeoutMillis; 25 | 26 | /** 27 | * True if the mapping configuration should also be applied in reverse, can be {@code null}. 28 | */ 29 | public Boolean reversible; 30 | } 31 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/api/response/InfoResponse.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.api.response; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | /** 7 | * Response format of client for info command. 8 | */ 9 | public class InfoResponse { 10 | 11 | public InfoResponse() {} 12 | 13 | /** 14 | * Contains the serialized onegraph string. 15 | */ 16 | public String serializedOG; 17 | 18 | /** 19 | * Contains line numbers of lines in the {@link #serializedOG} that are not RDF compatible. 20 | */ 21 | public Set rdfNonCompatibleLines = new HashSet<>(); 22 | 23 | /** 24 | * Contains line numbers of lines in the {@link #serializedOG} that are not LPG compatible. 25 | */ 26 | public Set lpgNonCompatibleLines = new HashSet<>(); 27 | 28 | /** 29 | * Contains line numbers of lines in the {@link #serializedOG} that are pairwise RDF non-compatible. 30 | */ 31 | public Set pairwiseNonCompatibleLines = new HashSet<>(); 32 | } 33 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/api/response/QueryResponse.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.api.response; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | /** 9 | * Response format of client for query command. 10 | */ 11 | @JsonInclude(JsonInclude.Include.NON_NULL) 12 | public class QueryResponse { 13 | 14 | public QueryResponse() {} 15 | 16 | /** 17 | * Type of query response, see {@link QueryResponseType} for an explanation. 18 | */ 19 | public QueryResponseType type; 20 | 21 | /** 22 | * The boolean result if {@link #type} is {@code SPARQLBOOLEAN} else {@code null}. 23 | */ 24 | public Boolean booleanResult; 25 | 26 | /** 27 | * The tuple result if {@link #type} is {@code SPARLQTUPLE}, else {@code null}. 28 | */ 29 | public Map> tupleResult; 30 | 31 | /** 32 | * The graph result if {@link #type} is {@code SPARQLGRAPH}, else {@code null}. 33 | */ 34 | public Map> graphResult; 35 | 36 | /** 37 | * The traversal result if {@link #type} is {@code GREMLINTRAVERSAL}, else {@code null}. 38 | */ 39 | public List traversalResult; 40 | } 41 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/api/response/QueryResponseType.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.api.response; 2 | 3 | /** 4 | * Used to indicate what kind of query response the {@link QueryResponse} is. 5 | */ 6 | public enum QueryResponseType { 7 | 8 | /** 9 | * The query response is of a Gremlin traversal. 10 | */ 11 | GREMLINTRAVERSAL, 12 | 13 | /** 14 | * The query response is of a SPARQL graph query. 15 | */ 16 | SPARQLGRAPH, 17 | 18 | /** 19 | * The query response is of a SPARQL tuple query. 20 | */ 21 | SPARQLTUPLE, 22 | 23 | /** 24 | * The query response is of a SPARQL boolean query. 25 | */ 26 | SPARQLBOOLEAN; 27 | } 28 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/api/response/SettingsResponse.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.api.response; 2 | 3 | import software.amazon.neptune.onegraph.playground.server.api.request.ConfigType; 4 | import software.amazon.neptune.onegraph.playground.server.state.State; 5 | 6 | /** 7 | * Response format when client makes GET request to /settings. 8 | */ 9 | public class SettingsResponse { 10 | 11 | public SettingsResponse() {} 12 | 13 | /** 14 | * The type of LPG mapping configuration currently in {@link State}. 15 | */ 16 | public ConfigType configType; 17 | 18 | /** 19 | * The query timeout in milliseconds currently in {@link State}. 20 | */ 21 | public Long timeoutMillis; 22 | 23 | /** 24 | * True if the LPG mapping configuration currently in {@link State} is reversible. 25 | */ 26 | public Boolean reversible; 27 | 28 | /** 29 | * The path the custom LPG mapping configuration was loaded from. 30 | */ 31 | public String pathToConfig; 32 | } 33 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/constants/URLConstants.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.constants; 2 | 3 | /** 4 | * Class containing URLs constants used to create IRIs. 5 | */ 6 | public final class URLConstants { 7 | 8 | /** 9 | * Base URL for IRIs, used for mapping from LPG property names and labels to RDF. 10 | */ 11 | public static final String BASE = "http://aws.amazon.com/neptune/ogplayground/data"; 12 | 13 | /** 14 | * Default URL used for LPG node labels to RDF IRIs. 15 | */ 16 | public static final String DEFAULT_NODE_LABEL = BASE + "/label/"; 17 | 18 | /** 19 | * Default URL used for LPG edge labels to RDF IRIs. 20 | */ 21 | public static final String EDGE = BASE + "/edge/"; 22 | 23 | /** 24 | * Default URL used for vertex IDs. 25 | */ 26 | public static final String ID = BASE + "/id/"; 27 | 28 | /** 29 | * Default URL used for LPG property names to RDF IRIs. 30 | */ 31 | public static final String PROPERTY_NAME = BASE + "/propertyName/"; 32 | 33 | /** 34 | * The default graph, when statements are translated over from RDF Models to OneGraph, statements having 35 | * the {@code null} context/graph will be put in this graph. 36 | */ 37 | public static final String DEFAULT_GRAPH = "http://aws.amazon.com/neptune/vocab/v01/DefaultNamedGraph"; 38 | } 39 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/io/parsing/ogparser/Token.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.io.parsing.ogparser; 2 | 3 | /** 4 | * A {@link Token} is a single "word" in a serialized OG data set. 5 | * e.g "_:A :knows _:B __:SID1 in :graph1" contains 6 {@link Token}s. 6 | */ 7 | class Token { 8 | 9 | /** 10 | * The raw string content of the token. 11 | */ 12 | public String content; 13 | 14 | /** 15 | * A token keeps track on which line it is, for error messaging. 16 | */ 17 | public int lineNum = 0; 18 | 19 | /** 20 | * The type of the token. Note: A token being a certain type does not mean that that token is not malformed, 21 | * For example, the parser may assign a token the type IRI because an opening tag was seen (<), but this does 22 | * not mean that this is then a valid IRI. 23 | */ 24 | public TokenType type; 25 | 26 | /** 27 | * Creates a new Token with underlying content and type 28 | * @param content The raw string of the token, this is not validated. 29 | * @param type The assumed type of the raw string. 30 | */ 31 | public Token(String content, TokenType type) { 32 | this.content = content; 33 | this.type = type; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/io/parsing/ogparser/TokenType.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.io.parsing.ogparser; 2 | 3 | /** 4 | * The different types a {@link Token} can be during parsing in {@link OGParser}. 5 | * The exact format of some of these tokens can be found in the 6 | * N-Triples specification. 7 | */ 8 | enum TokenType { 9 | 10 | /** 11 | * IRI token type, see the "IRIs" section of the N-Triples specification. 12 | */ 13 | IRI, 14 | 15 | /** 16 | * Blank node token type, see the "RDF Blank Nodes" section of the N-Triples specification. 17 | */ 18 | BNODE, 19 | 20 | /** 21 | * Literal token type, see the "RDF Literals" section of the N-Triples specification. 22 | */ 23 | LITERAL, 24 | 25 | /** 26 | * The word 'in' 27 | */ 28 | IN, 29 | 30 | /** 31 | * Statement identifier, looks like: 32 | * {@literal __:statementID} 33 | */ 34 | SID, 35 | 36 | /** 37 | * The character 'U' 38 | */ 39 | FLAG_U, 40 | 41 | /** 42 | * The '#' 43 | */ 44 | COMMENT 45 | } 46 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/io/serializing/SerializerException.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.io.serializing; 2 | 3 | import lombok.NonNull; 4 | 5 | /** 6 | * All problems that occur during the serializing are thrown as 7 | * {@link SerializerException} containing a message to help the user fix the issue. 8 | */ 9 | public class SerializerException extends RuntimeException { 10 | 11 | /** 12 | * Creates a new serializer exception with the given message and cause. 13 | * @param message The exception message seen by the user. 14 | * @param cause The exception that caused this exception. 15 | */ 16 | public SerializerException(@NonNull String message, @NonNull Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/io/serializing/lpgserializer/NeptuneCSVCardinality.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.io.serializing.lpgserializer; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * Part of {@link NeptuneCSVColumn}, holds the cardinality of the column 7 | */ 8 | enum NeptuneCSVCardinality { 9 | 10 | SINGLE(""), 11 | 12 | ARRAY("[]"); 13 | 14 | @Getter 15 | private final String cardinality; 16 | 17 | NeptuneCSVCardinality(String cardinality) { 18 | this.cardinality = cardinality; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/io/serializing/lpgserializer/NeptuneCSVColumn.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.io.serializing.lpgserializer; 2 | 3 | /** 4 | * Represents a column of a NeptuneCSV file. 5 | */ 6 | class NeptuneCSVColumn { 7 | /** 8 | * The name of the column 9 | */ 10 | public String name; 11 | 12 | /** 13 | * The data type of the column 14 | */ 15 | public NeptuneCSVDataType dataType; 16 | 17 | /** 18 | * The cardinality of the column 19 | */ 20 | public NeptuneCSVCardinality cardinality; 21 | } 22 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/io/serializing/lpgserializer/NeptuneCSVDataType.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.io.serializing.lpgserializer; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * Part of {@link NeptuneCSVColumn}, holds the data type of the column 7 | */ 8 | enum NeptuneCSVDataType { 9 | 10 | BOOL("Bool"), 11 | 12 | BYTE("Byte"), 13 | 14 | SHORT("Short"), 15 | 16 | INT("Int"), 17 | 18 | LONG("Long"), 19 | 20 | FLOAT("Float"), 21 | 22 | DOUBLE("Double"), 23 | 24 | STRING("String"), 25 | 26 | DATE("Date"), 27 | 28 | EMPTY(""); 29 | 30 | @Getter 31 | private final String type; 32 | 33 | NeptuneCSVDataType(String type) { 34 | this.type = type; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/mapping/ConverterException.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.mapping; 2 | 3 | import lombok.NonNull; 4 | 5 | public class ConverterException extends RuntimeException { 6 | 7 | /** 8 | * Creates a new converter exception with the given message. 9 | * @param message The exception message seen by the user. 10 | */ 11 | public ConverterException(@NonNull String message) { 12 | super(message); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/model/LPG/LPGEdge.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.model.LPG; 2 | 3 | import lombok.NonNull; 4 | 5 | /** 6 | * Implementation of the formal definition of a property graph edge. 7 | */ 8 | public class LPGEdge extends LPGElement { 9 | 10 | /** 11 | * The label of this edge, every edge must have a label. 12 | */ 13 | public final String label; 14 | 15 | /** 16 | * The out-vertex of this edge, (the vertex that has this edge outgoing) 17 | */ 18 | public final LPGVertex outVertex; 19 | 20 | /** 21 | * The in-vertex of this edge, (the vertex that has this edge incoming) 22 | */ 23 | public final LPGVertex inVertex; 24 | 25 | /** 26 | * Creates a new edge 27 | * @param outVertex The out-vertex 28 | * @param inVertex The in-vertex 29 | * @param label The label of this edge 30 | */ 31 | public LPGEdge(@NonNull LPGVertex outVertex, @NonNull LPGVertex inVertex, @NonNull String label) { 32 | this.outVertex = outVertex; 33 | this.inVertex = inVertex; 34 | this.label = label; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return this.outVertex + "-(" + this.label + ")-" + this.inVertex; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/model/onegraph/elements/OGElement.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.model.onegraph.elements; 2 | 3 | import software.amazon.neptune.onegraph.playground.server.model.onegraph.statements.OGStatement; 4 | import lombok.Setter; 5 | import software.amazon.neptune.onegraph.playground.server.model.onegraph.dataset.OGDataset; 6 | 7 | /** 8 | * Abstract superclass of {@link OGStatement}, 9 | * {@link OGGraph} and, {@link OGSimpleNode} 10 | */ 11 | public abstract class OGElement { 12 | 13 | /** 14 | * Elements only have an id in the context of an {@link OGDataset}, their {@code id} is set once they 15 | * have been added. 16 | */ 17 | @Setter 18 | protected long localId = 0; 19 | 20 | /** 21 | * Get the formal name for this element, the user sees this. 22 | * @return The formal name of the element. 23 | */ 24 | public abstract String formalName(); 25 | } 26 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/model/onegraph/elements/OGObject.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.model.onegraph.elements; 2 | 3 | import software.amazon.neptune.onegraph.playground.server.model.onegraph.statements.OGTripleStatement; 4 | 5 | /** 6 | * An {@link OGObject} is in {@code object} position of an {@link OGTripleStatement}. 7 | */ 8 | public interface OGObject { 9 | 10 | /** 11 | * Return {@code true} if this object could be the in-node of a labeled property graph edge, 12 | * false otherwise. 13 | * @return {@code true} or {@code false} depending on if this object could be the in-node of a 14 | * labeled property graph edge. 15 | */ 16 | boolean canBeInNodeOfEdge(); 17 | } 18 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/model/onegraph/elements/OGPredicate.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.model.onegraph.elements; 2 | 3 | import software.amazon.neptune.onegraph.playground.server.model.onegraph.statements.OGTripleStatement; 4 | import org.eclipse.rdf4j.model.IRI; 5 | 6 | import java.util.Optional; 7 | 8 | /** 9 | * An {@link OGPredicate} is in {@code predicate} position of an {@link OGTripleStatement}. 10 | * @param The type of the {@link #predicate()}, either {@link IRI} or {@link String}. 11 | */ 12 | public interface OGPredicate { 13 | 14 | /** 15 | * Returns the {@link String} if this predicate is of type {@link String}. 16 | * @return A {@link String} or the empty optional. 17 | */ 18 | Optional stringPredicate(); 19 | 20 | /** 21 | * Returns the {@link IRI} if this predicate is of type {@link IRI}. 22 | * @return An {@link IRI} or the empty optional. 23 | */ 24 | Optional iriPredicate(); 25 | } 26 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/model/onegraph/elements/OGPredicateString.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.model.onegraph.elements; 2 | 3 | import lombok.NonNull; 4 | import org.eclipse.rdf4j.model.IRI; 5 | import software.amazon.neptune.onegraph.playground.server.model.onegraph.statements.OGTripleStatement; 6 | 7 | import java.util.Optional; 8 | 9 | /** 10 | * An {@link OGPredicateString} can appear in the {@code predicate} position of an {@link OGTripleStatement}, 11 | * it has underlying {@link #content}. 12 | */ 13 | public class OGPredicateString implements OGPredicate { 14 | 15 | /** 16 | * The string content of this predicate. 17 | */ 18 | public final String content; 19 | 20 | /** 21 | * Creates a new simple node with its {@link #content} set to {@code content}. 22 | * @param content Is set to the {@link #content}. 23 | */ 24 | public OGPredicateString(@NonNull String content) { 25 | this.content = content; 26 | } 27 | 28 | @Override 29 | public Optional stringPredicate() { 30 | return Optional.of(this.content); 31 | } 32 | 33 | @Override 34 | public Optional iriPredicate() { 35 | return Optional.empty(); 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "\"" + content + "\""; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/model/onegraph/statements/OGStatement.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.model.onegraph.statements; 2 | 3 | /** 4 | * Abstract superclass of {@link OGMembershipStatement}, {@link OGPropertyStatement} and, {@link OGPropertyStatement} 5 | */ 6 | public interface OGStatement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/model/onegraph/statements/OGTripleStatement.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.model.onegraph.statements; 2 | 3 | import software.amazon.neptune.onegraph.playground.server.model.onegraph.elements.OGObject; 4 | import software.amazon.neptune.onegraph.playground.server.model.onegraph.elements.OGPredicate; 5 | import software.amazon.neptune.onegraph.playground.server.model.onegraph.elements.OGReifiableElement; 6 | 7 | import java.util.Optional; 8 | 9 | /** 10 | * An {@link OGTripleStatement} has a subject, predicate and object. Accessible by {@link #getSubject()}, 11 | * {@link #getPredicate()}, and {@link #getObject()} respectively. 12 | * Both {@link OGPropertyStatement} and {@link OGRelationshipStatement} are subclasses. 13 | */ 14 | public abstract class OGTripleStatement extends OGReifiableElement implements OGStatement { 15 | 16 | /** 17 | * Gets the subject of this triple statement. 18 | * @return The subject. 19 | */ 20 | public abstract OGReifiableElement getSubject(); 21 | 22 | /** 23 | * Gets the predicate of this triple statement. 24 | * @return The predicate. 25 | */ 26 | public abstract OGPredicate getPredicate(); 27 | 28 | /** 29 | * Gets the object of this triple statement. 30 | * @return The object. 31 | */ 32 | public abstract OGObject getObject(); 33 | } 34 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/querying/GremlinQueryingDelegate.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.querying; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Delegate used in {@link GremlinQuerying}. 7 | */ 8 | public interface GremlinQueryingDelegate { 9 | 10 | /** 11 | * Called when the Gremlin query executed successfully. 12 | * @param result The results of the query. 13 | */ 14 | void gremlinQueryFinishedWithResult(List result); 15 | 16 | /** 17 | * Called when the Gremlin query failed to execute. 18 | * @param exception The exception that occurred. 19 | */ 20 | void gremlinQueryFailedWithException(QueryException exception); 21 | } 22 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/querying/QueryException.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.querying; 2 | 3 | /** 4 | * All problems that occur during querying are thrown as 5 | * {@link QueryException} containing a message to help the user fix the issue. 6 | */ 7 | public class QueryException extends RuntimeException { 8 | /** 9 | * Creates a new query exception with the given message and cause. 10 | * @param message The exception message seen by the user. 11 | * @param cause The exception that caused this exception. 12 | */ 13 | QueryException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/querying/SPARQLQueryingDelegate.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.querying; 2 | 3 | import org.eclipse.rdf4j.model.Model; 4 | import org.eclipse.rdf4j.model.Value; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | /** 10 | * Delegate used in {@link SPARQLQuerying}. 11 | */ 12 | public interface SPARQLQueryingDelegate { 13 | 14 | /** 15 | * Called when the SPARQL query finished with a boolean result. 16 | * @param result The boolean result of the query. 17 | */ 18 | void SPARQLQueryFinishedWithResult(boolean result); 19 | 20 | /** 21 | * Called when the SPARQL query finished with an RDF {@link Model} result. 22 | * @param result The {@link Model} result of the query. 23 | */ 24 | void SPARQLQueryFinishedWithResult(Model result); 25 | 26 | /** 27 | * Called when the SPARQL query finished with a key-value result. 28 | * @param result The key-value result of the query. 29 | */ 30 | void SPARQLQueryFinishedWithResult(Map> result); 31 | 32 | /** 33 | * Called when the SPARQL query failed to execute. 34 | * @param exception The exception that occurred. 35 | */ 36 | void SPARQLQueryFailedWithException(QueryException exception); 37 | } 38 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/service/Service.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.service; 2 | 3 | import software.amazon.neptune.onegraph.playground.server.state.State; 4 | 5 | /** 6 | * A service handles a particular command of the playground.
7 | * Subclasses:
8 | * {@link ClearService}, 9 | * {@link SettingsService}, 10 | * {@link ExportService}, 11 | * {@link InfoService}, 12 | * {@link LoadService}, 13 | * {@link QueryService}, 14 | * {@link ViewService} 15 | * 16 | */ 17 | public abstract class Service { 18 | 19 | /** 20 | * Each service needs to have a reference to the {@link State}. 21 | */ 22 | protected final State state; 23 | 24 | protected Service(State state) { 25 | this.state = state; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/servicespring/ClearServiceSpring.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.servicespring; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import software.amazon.neptune.onegraph.playground.server.service.ClearService; 6 | import software.amazon.neptune.onegraph.playground.server.state.StateSpring; 7 | 8 | /** 9 | * Spring Service that handles the clear command. 10 | */ 11 | @Service 12 | public class ClearServiceSpring extends ClearService { 13 | @Autowired 14 | public ClearServiceSpring(StateSpring state) { 15 | super(state); 16 | } 17 | } -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/servicespring/ExportServiceSpring.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.servicespring; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import software.amazon.neptune.onegraph.playground.server.state.StateSpring; 6 | import software.amazon.neptune.onegraph.playground.server.service.ExportService; 7 | 8 | /** 9 | * Spring Service that handles the export command. 10 | */ 11 | @Service 12 | public class ExportServiceSpring extends ExportService { 13 | 14 | @Autowired 15 | public ExportServiceSpring(StateSpring state) { 16 | super(state); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/servicespring/InfoServiceSpring.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.servicespring; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import software.amazon.neptune.onegraph.playground.server.service.InfoService; 6 | import software.amazon.neptune.onegraph.playground.server.state.StateSpring; 7 | 8 | /** 9 | * Spring Service that handles the info command. 10 | */ 11 | @Service 12 | public class InfoServiceSpring extends InfoService { 13 | 14 | @Autowired 15 | public InfoServiceSpring(StateSpring state) { 16 | super(state); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/servicespring/LoadServiceSpring.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.servicespring; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import software.amazon.neptune.onegraph.playground.server.service.LoadService; 6 | import software.amazon.neptune.onegraph.playground.server.state.StateSpring; 7 | 8 | /** 9 | * Spring Service that handles the load command. 10 | */ 11 | @Service 12 | public class LoadServiceSpring extends LoadService { 13 | 14 | @Autowired 15 | public LoadServiceSpring(StateSpring state) { 16 | super(state); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/servicespring/QueryServiceSpring.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.servicespring; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import software.amazon.neptune.onegraph.playground.server.service.QueryService; 6 | import software.amazon.neptune.onegraph.playground.server.state.StateSpring; 7 | 8 | /** 9 | * Spring Service that handles the query command. 10 | */ 11 | @Service 12 | public class QueryServiceSpring extends QueryService { 13 | 14 | @Autowired 15 | public QueryServiceSpring(StateSpring state) { 16 | super(state); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/servicespring/SettingsServiceSpring.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.servicespring; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import software.amazon.neptune.onegraph.playground.server.service.SettingsService; 6 | import software.amazon.neptune.onegraph.playground.server.state.StateSpring; 7 | 8 | /** 9 | * Spring Service that handles the config command. 10 | */ 11 | @Service 12 | public class SettingsServiceSpring extends SettingsService { 13 | 14 | @Autowired 15 | public SettingsServiceSpring(StateSpring state) { 16 | super(state); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/servicespring/ViewServiceSpring.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.servicespring; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import software.amazon.neptune.onegraph.playground.server.service.ViewService; 6 | import software.amazon.neptune.onegraph.playground.server.state.StateSpring; 7 | 8 | /** 9 | * Spring Service that handles the view command. 10 | */ 11 | @Service 12 | public class ViewServiceSpring extends ViewService { 13 | 14 | @Autowired 15 | public ViewServiceSpring(StateSpring state, ExportServiceSpring es) { 16 | super(state, es); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/java/software/amazon/neptune/onegraph/playground/server/state/StateSpring.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.state; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | /** 6 | * Spring Component that keeps the state. 7 | */ 8 | @Component 9 | public class StateSpring extends State { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/java/software/amazon/neptune/onegraph/playground/server/mockdata/io/IOTinkerPopTestData.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.mockdata.io; 2 | 3 | import org.apache.tinkerpop.gremlin.structure.Graph; 4 | import org.apache.tinkerpop.gremlin.structure.Vertex; 5 | import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; 6 | 7 | /** 8 | * Contains different test scenarios for TinkerPop {@link Graph}s 9 | */ 10 | public class IOTinkerPopTestData { 11 | public static Graph tinkerPopGraphAliceKnowsBobWithEmptyNode() { 12 | Graph g = TinkerGraph.open(); 13 | Vertex alice = g.addVertex("Person"); 14 | Vertex bob = g.addVertex("Person"); 15 | g.addVertex(); 16 | 17 | alice.property("name","Alice"); 18 | bob.property("name","Bob"); 19 | 20 | alice.addEdge("knows",bob,"since",1955); 21 | 22 | return g; 23 | } 24 | 25 | public static Graph tinkerPopGraphConflictingKeyForGraphML() { 26 | Graph g = TinkerGraph.open(); 27 | Vertex alice = g.addVertex("Person"); 28 | Vertex bob = g.addVertex("Person"); 29 | g.addVertex(); 30 | 31 | alice.property("name","Alice"); 32 | bob.property("labelV","thisWillProduceConflict"); 33 | 34 | alice.addEdge("labelE",bob,"labelE",1955); 35 | 36 | return g; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/java/software/amazon/neptune/onegraph/playground/server/mockdata/tinkerpopconversion/MetaProperties.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.mockdata.tinkerpopconversion; 2 | 3 | import org.apache.tinkerpop.gremlin.structure.Graph; 4 | import org.apache.tinkerpop.gremlin.structure.Vertex; 5 | import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; 6 | import software.amazon.neptune.onegraph.playground.server.mapping.TinkerPopConverter; 7 | import software.amazon.neptune.onegraph.playground.server.model.LPG.LPGGraph; 8 | import software.amazon.neptune.onegraph.playground.server.model.LPG.LPGVertex; 9 | 10 | /** 11 | * Test case to see if warning is thrown when there are meta properties in the TinkerPop graph, 12 | * calls the {@code delegate} of the {@link TinkerPopConverter}. 13 | */ 14 | public class MetaProperties extends TinkerConversionTestCase { 15 | 16 | @Override 17 | public Graph tinkerPopGraph() { 18 | Graph g = TinkerGraph.open(); 19 | Vertex alice = g.addVertex("Person"); 20 | alice.property("child","mark","acl:","user1234"); 21 | return g; 22 | } 23 | 24 | @Override 25 | public LPGGraph lpgGraph() { 26 | LPGGraph graph = new LPGGraph(); 27 | LPGVertex alice = new LPGVertex("Person"); 28 | alice.addPropertyValue("child","mark"); 29 | graph.addVertices(alice); 30 | return graph; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/java/software/amazon/neptune/onegraph/playground/server/mockdata/tinkerpopconversion/MultiLabeledVertex.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.mockdata.tinkerpopconversion; 2 | 3 | import org.apache.tinkerpop.gremlin.structure.Graph; 4 | import org.apache.tinkerpop.gremlin.structure.Vertex; 5 | import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; 6 | import software.amazon.neptune.onegraph.playground.server.mapping.TinkerPopConverter; 7 | import software.amazon.neptune.onegraph.playground.server.model.LPG.LPGGraph; 8 | import software.amazon.neptune.onegraph.playground.server.model.LPG.LPGVertex; 9 | 10 | /** 11 | * Test case with multi-valued labels of vertices, 12 | * calls the {@code delegate} of the {@link TinkerPopConverter}. 13 | * 14 | * This test case should only be used to go from LPG to Tinker. 15 | */ 16 | public class MultiLabeledVertex extends TinkerConversionTestCase { 17 | 18 | @Override 19 | public Graph tinkerPopGraph() { 20 | Graph g = TinkerGraph.open(); 21 | Vertex alice = g.addVertex("Person"); 22 | alice.property("name", "Alice"); 23 | return g; 24 | } 25 | 26 | @Override 27 | public LPGGraph lpgGraph() { 28 | LPGGraph graph = new LPGGraph(); 29 | LPGVertex alice = new LPGVertex("Person","Boss","Woman"); 30 | alice.addPropertyValue("name", "Alice"); 31 | 32 | graph.addVertices(alice); 33 | return graph; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/java/software/amazon/neptune/onegraph/playground/server/mockdata/tinkerpopconversion/NonExplicitLabels.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.mockdata.tinkerpopconversion; 2 | 3 | import org.apache.tinkerpop.gremlin.structure.Graph; 4 | import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; 5 | import software.amazon.neptune.onegraph.playground.server.model.LPG.LPGGraph; 6 | import software.amazon.neptune.onegraph.playground.server.model.LPG.LPGVertex; 7 | 8 | /** 9 | * Test case where there is mapping between not explicitly labeled vertices. 10 | */ 11 | public class NonExplicitLabels extends TinkerConversionTestCase { 12 | @Override 13 | public Graph tinkerPopGraph() { 14 | Graph g = TinkerGraph.open(); 15 | g.addVertex(); 16 | return g; 17 | } 18 | 19 | @Override 20 | public LPGGraph lpgGraph() { 21 | LPGGraph graph = new LPGGraph(); 22 | LPGVertex alice = new LPGVertex(); 23 | graph.addVertices(alice); 24 | return graph; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/java/software/amazon/neptune/onegraph/playground/server/mockdata/tinkerpopconversion/TinkerConversionTestCase.java: -------------------------------------------------------------------------------- 1 | package software.amazon.neptune.onegraph.playground.server.mockdata.tinkerpopconversion; 2 | 3 | import org.apache.tinkerpop.gremlin.structure.Graph; 4 | import software.amazon.neptune.onegraph.playground.server.mapping.TinkerPopConverter; 5 | import software.amazon.neptune.onegraph.playground.server.model.LPG.LPGGraph; 6 | 7 | import java.util.Calendar; 8 | import java.util.Date; 9 | import java.util.GregorianCalendar; 10 | 11 | /** 12 | * Test scenarios for the conversion between LPG {@link LPGGraph}s and TinkerPop {@link Graph}s. 13 | */ 14 | public abstract class TinkerConversionTestCase { 15 | 16 | /** 17 | * Resulting TinkerPop graph when using the {@link TinkerPopConverter} 18 | * on the graph given by {@link #lpgGraph()}. 19 | */ 20 | public abstract Graph tinkerPopGraph(); 21 | 22 | /** 23 | * Resulting LPG when using the {@link TinkerPopConverter} 24 | * on the graph given by {@link #tinkerPopGraph()}. 25 | */ 26 | public abstract LPGGraph lpgGraph(); 27 | 28 | /** 29 | * The 6th of June 1985 00:00:00 30 | * @return 6th of June 1985 00:00:00. 31 | */ 32 | protected Date get1985() { 33 | Calendar calendar = GregorianCalendar.getInstance(); 34 | calendar.setTimeInMillis(486910861000L); 35 | return calendar.getTime(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/LPG/LPGMappingConfigurations/malformed_lpg_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "default_node_label": "http://example.com/dnl", 3 | "node_label_mapping": { 4 | "Person": [{}, 5 | "http://example.com/is", 6 | "http://example.com/Person" 7 | ],z 8 | "Boss": [ 9 | "http://example.com/type", 10 | "http://example.com/Boss" 11 | ], 12 | "Dog": [ 13 | "http://example.com/is", 14 | "Dog" 15 | ] 16 | } 17 | }} 18 | 19 | "age" : "http://example.com/age", 20 | "probability" : "chance" 21 | } 22 | } -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/LPG/LPGMappingConfigurations/malformed_lpg_config_incorrect_array_size.json: -------------------------------------------------------------------------------- 1 | { 2 | "default_node_label" : "http://example.com/dnl", 3 | "node_label_mapping" : { 4 | "Person" : ["http://example.com/is", "http://example.com/Person"], 5 | "Boss" : ["http://example.com/type"], 6 | "Dog" : ["http://example.com/is", "Dog"] 7 | }, 8 | "edge_label_mapping" : { 9 | "knows" : "http://example.com/knows", 10 | "connected" : "Connected to" 11 | }, 12 | "property_name_mapping" : { 13 | "age" : "http://example.com/age", 14 | "probability" : "chance" 15 | } 16 | } -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/LPG/LPGMappingConfigurations/normal_lpg_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "default_node_label" : "http://example.com/dnl", 3 | "node_label_mapping" : { 4 | "Person" : ["http://example.com/is", "http://example.com/Person"], 5 | "Boss" : ["http://example.com/type", "http://example.com/Boss"], 6 | "Dog" : ["http://example.com/is", "Dog"] 7 | }, 8 | "edge_label_mapping" : { 9 | "knows" : "http://example.com/knows", 10 | "connected" : "Connected to" 11 | }, 12 | "property_name_mapping" : { 13 | "age" : "http://example.com/age", 14 | "probability" : "chance" 15 | } 16 | } -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/LPG/LPGMappingConfigurations/not_an_iri_lpg_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "default_node_label" : "this should be an iri", 3 | "node_label_mapping" : { 4 | "Person" : ["this should be an iri", "http://example.com/Person"], 5 | "Boss" : ["http://example.com/type", "http://example.com/Boss"], 6 | "Dog" : ["http://example.com/is", "Dog"] 7 | }, 8 | "edge_label_mapping" : { 9 | "knows" : "http://example.com/knows", 10 | "connected" : "Connected to" 11 | }, 12 | "property_name_mapping" : { 13 | "age" : "http://example.com/age", 14 | "probability" : "chance" 15 | } 16 | } -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/LPG/NeptuneCSV/nCSV_edges_multi_edge.csv: -------------------------------------------------------------------------------- 1 | ~id,~from,~to,~label 2 | 1,1,2,knows;likes 3 | 2,2,3,, 4 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/LPG/NeptuneCSV/nCSV_edges_normal.csv: -------------------------------------------------------------------------------- 1 | ~id,~from,~to,~label, since:Date, probability:Float 2 | 1,1,2,knows, 1958-06-12T00:00:00Z,0.6 3 | 2,2,3,likes, 1904-09-09T00:00:00Z, 4 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/LPG/NeptuneCSV/nCSV_malformed.csv: -------------------------------------------------------------------------------- 1 | d, ~label, age:, name:Int 2 | 1,Person, 96, "Elizabeth" 3 | 2,Person, 39, 183, "Harry" 4 | 3,Person, 5 | 4,Dog,5,55, 6 | 5,Cat,3,16, 7 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/LPG/NeptuneCSV/nCSV_nodes_bad_date.csv: -------------------------------------------------------------------------------- 1 | ~id, ~label, age:Int, name:String[], birthDate:Date 2 | 1,Person;Queen, 96, "Elizabeth;Alexandra;Mary;Windsor",1234556-132451-ZZ 3 | 2,Person, 39, Harry 4 | 3,Person, 22, 5 | 4,Dog,5, 6 | 5,,3, 7 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/LPG/NeptuneCSV/nCSV_nodes_normal.csv: -------------------------------------------------------------------------------- 1 | ~id, ~label, age:Int, name:String[], birthDate:Date 2 | 1,Person;Queen, 96, "Elizabeth;Alexandra;Mary;Windsor",2022-05-18T07:22:50Z 3 | 2,Person, 39, Harry 4 | 3,Person, 22, 5 | 4,Dog,5, 6 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/LPG/NeptuneCSV/nCSV_same_prop_names.csv: -------------------------------------------------------------------------------- 1 | ~id, ~label, age:Double[] 2 | 1,Person;Queen, 75.00;85.00 3 | 4 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/RDF/NTriples/ntriples_normal.nt: -------------------------------------------------------------------------------- 1 | . 2 | _:subject1 "object1" . 3 | _:subject2 "object2"^^ . -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/RDF/TriG/trig_normal.trig: -------------------------------------------------------------------------------- 1 | @prefix rdf: . 2 | @prefix xsd: . 3 | @prefix swp: . 4 | @prefix dc: . 5 | @prefix ex: . 6 | @prefix : . 7 | 8 | :G1 { :Bob ex:name "Bob Bobson" . 9 | :Bob ex:homepage . 10 | :Bob ex:email . 11 | :Bob ex:hasSkill ex:Management } 12 | 13 | :G2 { :Bob rdf:type ex:Person . 14 | :Bob ex:hasSkill ex:Programming } 15 | 16 | :G3 { :G1 swp:assertedBy _:w1 . 17 | _:w1 swp:authority :Tom . 18 | _:w1 dc:date "2003-10-02"^^xsd:date . 19 | :G2 swp:quotedBy _:w2 . 20 | :G3 swp:assertedBy _:w2 . 21 | _:w2 dc:date "2003-09-03"^^xsd:date . 22 | _:w2 swp:authority :Tom . 23 | :Tom rdf:type ex:Person . 24 | :Tom ex:email } 25 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/RDF/Turtle/turtle_normal.ttl: -------------------------------------------------------------------------------- 1 | @prefix rdf: . 2 | @prefix dc: . 3 | @prefix ex: . 4 | 5 | 6 | dc:title "RDF/XML Syntax" ; 7 | ex:editor [ 8 | ex:fullname "Tom Tomson"; 9 | ex:homePage 10 | ] . 11 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/RDF/nQuads/nquads_normal.nq: -------------------------------------------------------------------------------- 1 | . 2 | "object1" . 3 | "2"^^ . 4 | "3"^^ . 5 | _:subject2 "object2" . 6 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/RDF/rdfxml/rdfxml_normal.rdf: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | John 7 | 35 8 | 9 | 10 | Alice 11 | 10 12 | 13 | 14 | 15 | 16 | 17 | Test 18 | 8 19 | 20 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/literals/og_lit_dataTypes.txt: -------------------------------------------------------------------------------- 1 | "2"^^ . 2 | "1.663E-4"^^ . 3 | "this is a string"^^ . -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/literals/og_lit_escapedCharacters.txt: -------------------------------------------------------------------------------- 1 | "simple string \", . abcd \n \r ' " . -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/literals/og_lit_languageTags.txt: -------------------------------------------------------------------------------- 1 | "hello"@en . 2 | "au revoir"@fr-be . 3 | "12345"@nl . 4 | "auf wiedersehen"@de . -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/literals/og_lit_unicodeEscaped.txt: -------------------------------------------------------------------------------- 1 | "lorem \u00ae ipsum \u00a2 dolor \u00bf sit \u00be amet \u00a9" . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_malformed_iri.txt: -------------------------------------------------------------------------------- 1 | . -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_malformed_literal.txt: -------------------------------------------------------------------------------- 1 | "2"^^@langtag . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_malformed_literal_2.txt: -------------------------------------------------------------------------------- 1 | "2" ^^ . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_malformed_literal_3.txt: -------------------------------------------------------------------------------- 1 | "2^^ . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_malformed_literal_4.txt: -------------------------------------------------------------------------------- 1 | "2"^^ . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_malformed_literal_5.txt: -------------------------------------------------------------------------------- 1 | "2"test . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_malformed_literal_6.txt: -------------------------------------------------------------------------------- 1 | "2"^ . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_missing_sid.txt: -------------------------------------------------------------------------------- 1 | __:sid2 . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_unexpected_entry.txt: -------------------------------------------------------------------------------- 1 | . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_unexpected_entry_2.txt: -------------------------------------------------------------------------------- 1 | in __:graph1 . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_unexpected_entry_3.txt: -------------------------------------------------------------------------------- 1 | \ F . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_unexpected_entry_4.txt: -------------------------------------------------------------------------------- 1 | _ _ . -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_unexpected_entry_5.txt: -------------------------------------------------------------------------------- 1 | example.com . -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_unexpected_eol.txt: -------------------------------------------------------------------------------- 1 | . 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/malformed/og_unexpected_eol_2.txt: -------------------------------------------------------------------------------- 1 | # comment 2 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/normal/og_normal_1.txt: -------------------------------------------------------------------------------- 1 | # 2 | __:123 in . 3 | _:bnode in , . 4 | __:126 in , . 5 | __:124 \ U. 6 | "hello"@en-US __:124 in _:aGraph . 7 | __:124 in _:aGraph, . 8 | __:123 . # comment 9 | # comment 10 | # 11 | __:126 in , , . 12 | "2"^^ __:1234 . 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/normal/og_normal_2.txt: -------------------------------------------------------------------------------- 1 | _:thisIsALongBlankNode1345LoremIpsumDolorSitAmet _:anotherBNode in _:aBnodeGraph . 2 | _:1thisBlankNodeWillBePrefixed _:anotherBNode __:S124 in _:aBnodeGraph,_:aBnodeGraph2 , _:aBnodeGraph2 . 3 | # 4 | # 5 | # 6 | # 7 | "2"^^ __:1234 . # Here starts a comment. 8 | __:124 \ U . 9 | 10 | 11 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/normal/og_normal_3.txt: -------------------------------------------------------------------------------- 1 | in , , . 2 | in ,, . 3 | in _:graph1,, , _:graph4 . 4 | __:sid3 in _:graph1,, , _:graph4 . 5 | __:sid1 \ U . 6 | __:sid2 . 7 | -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/referenceCycles/og_ref_cycle_complex.txt: -------------------------------------------------------------------------------- 1 | __:sid2 __:sid1 . 2 | __:sid3 __:sid2 . 3 | __:sid4 __:sid3 . 4 | __:sid5 __:sid4 . 5 | __:sid6 __:sid5 . 6 | __:sid7 __:sid6 . 7 | __:sid8 __:sid7 . 8 | __:sid9 __:sid8 . 9 | __:sid10 __:sid9 . 10 | __:sid11 __:sid10 . 11 | __:sid12 __:sid11 . 12 | __:sid13 __:sid12 . 13 | __:sid14 __:sid13 . 14 | __:sid15 __:sid14 . 15 | __:sid16 __:sid15 . 16 | __:sid1 "literal" __:sid16 . -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/referenceCycles/og_ref_cycle_self.txt: -------------------------------------------------------------------------------- 1 | __:sid1 __:sid1 . -------------------------------------------------------------------------------- /1g-playground/1g-playground-server/src/test/resources/parserTestDatasets/oneGraph/referenceCycles/og_ref_cycle_simple.txt: -------------------------------------------------------------------------------- 1 | __:sid3 __:sid1 . 2 | __:sid6 __:sid1 __:sid2 . 3 | __:sid4 __:sid3 . 4 | __:sid5 __:sid4 . 5 | __:sid2 __:sid5 . 6 | __:sid6 . -------------------------------------------------------------------------------- /1g-playground/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | software.amazon.neptune 8 | Neptune1GPlaygroundPublic 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 8 13 | 8 14 | 15 | 16 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/.gitignore: -------------------------------------------------------------------------------- 1 | *.js 2 | !jest.config.js 3 | *.d.ts 4 | node_modules 5 | 6 | # CDK asset staging directory 7 | .cdk.staging 8 | cdk.out 9 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | !*.d.ts 3 | 4 | # CDK asset staging directory 5 | .cdk.staging 6 | cdk.out 7 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/THIRD-PARTY-LICENSES: -------------------------------------------------------------------------------- 1 | lib/amundsen-stack 2 | 3 | license: Apache-2.0 4 | authors: Peter Hanssens 5 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "npx ts-node --prefer-ts-exts bin/amundsen-cdk.ts", 3 | "watch": { 4 | "include": [ 5 | "**" 6 | ], 7 | "exclude": [ 8 | "README.md", 9 | "cdk*.json", 10 | "**/*.d.ts", 11 | "**/*.js", 12 | "tsconfig.json", 13 | "package*.json", 14 | "yarn.lock", 15 | "node_modules", 16 | "test" 17 | ] 18 | }, 19 | "context": { 20 | "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, 21 | "@aws-cdk/core:stackRelativeExports": true, 22 | "@aws-cdk/aws-rds:lowercaseDbIdentifier": true, 23 | "@aws-cdk/aws-lambda:recognizeVersionProps": true, 24 | "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true, 25 | "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, 26 | "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, 27 | "@aws-cdk/aws-iam:minimizePolicies": true, 28 | "@aws-cdk/core:target-partitions": [ 29 | "aws", 30 | "aws-cn" 31 | ], 32 | "vpc-cidr": "10.100.0.0/16", 33 | "rds-engine": "POSTGRES", 34 | "rds-port": 5432, 35 | "rds-database": "sample", 36 | "sample-data-s3-bucket": "amundsen-neptune-blog", 37 | "sample-data-rds-dump-filename": "amundsen_sample.dump", 38 | "sample-data-redshift-query-s3-bucket": "amundsen-neptune-blog", 39 | "sample-data-redshift-query-filename": "amundsen_dw.sql", 40 | "application":"amundsen", 41 | "environment":"dev" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/data/amundsen_dw.sql: -------------------------------------------------------------------------------- 1 | create schema chatbot_dw; 2 | 3 | create table chatbot_dw.author_summary as 4 | select a.name,count(pa.*) as post_count 5 | from chatbot_external.authors as a 6 | inner join chatbot_external.post_authors as pa on a.author_id = pa.author_id 7 | group by a.name 8 | order by count(pa.*) desc; 9 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/data/amundsen_sample.dump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/amazon-neptune-and-aws-cdk-for-amundsen/data/amundsen_sample.dump -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/images/amazon-neptune-and-aws-cdk-for-amundsen-solution overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/amazon-neptune-and-aws-cdk-for-amundsen/images/amazon-neptune-and-aws-cdk-for-amundsen-solution overview.png -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testEnvironment: 'node', 3 | roots: ['/test'], 4 | testMatch: ['**/*.test.ts'], 5 | transform: { 6 | '^.+\\.tsx?$': 'ts-jest' 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/lib/databuilders/.dockerignore: -------------------------------------------------------------------------------- 1 | **/venv/** 2 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/lib/databuilders/.gitignore: -------------------------------------------------------------------------------- 1 | **/venv/** 2 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/lib/databuilders/postgres/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM amazonlinux:2 2 | COPY . /app 3 | WORKDIR /app 4 | RUN yum update -y 5 | RUN yum install python3 python3-devel gcc gcc-gfortran postgresql-devel -y 6 | RUN pip3 install --upgrade pip 7 | RUN pip install -r requirements.txt 8 | CMD python3 ./postgres_extract_neptune_publish.py 9 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/lib/databuilders/postgres/THIRD-PARTY-LICENSES: -------------------------------------------------------------------------------- 1 | amundsen-databuilder 2 | 4.2.2 3 | license: Apache-2.0 4 | authors: Lyft, Inc. 5 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/lib/databuilders/postgres/requirements.txt: -------------------------------------------------------------------------------- 1 | amundsen-databuilder==4.2.2 2 | amundsen-gremlin==0.0.7 3 | amundsen-rds==0.0.3 4 | boto3==1.17.43 5 | botocore==1.20.43 6 | elasticsearch==6.8.2 7 | Flask==2.3.2 8 | gremlinpython==3.4.10 9 | overrides==3.1.0 10 | psycopg2-binary==2.8.6 11 | pyhocon==0.3.57 12 | requests-aws4auth==1.0.1 13 | SQLAlchemy==1.4.5 14 | versioneer==0.19 15 | numpy==1.22.0 16 | pandas==1.1.5 17 | markupsafe==2.0.1 -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/lib/sample-dbs-stack.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | import {Stack, StackProps} from 'aws-cdk-lib'; 4 | import {Construct} from 'constructs'; 5 | 6 | export class SampleDbsStack extends Stack { 7 | constructor(scope: Construct, id: string, props?: StackProps) { 8 | super(scope, id, props); 9 | 10 | // The code that defines your stack goes here 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "amundsen-cdk", 3 | "version": "0.1.0", 4 | "bin": { 5 | "amundsen-cdk": "bin/amundsen-cdk.js" 6 | }, 7 | "scripts": { 8 | "build": "tsc", 9 | "watch": "tsc -w", 10 | "test": "jest", 11 | "cdk": "cdk" 12 | }, 13 | "devDependencies": { 14 | "@types/jest": "^26.0.10", 15 | "@types/node": "10.17.27", 16 | "jest": "^29.7.0", 17 | "ts-jest": "^26.2.0", 18 | "aws-cdk": "2.20.0", 19 | "@aws-cdk/assert": "2.20.0", 20 | "ts-node": "^9.0.0", 21 | "typescript": "~3.9.7" 22 | }, 23 | "dependencies": { 24 | "@aws-cdk/aws-redshift-alpha": "^2.20.0-alpha.0", 25 | "aws-cdk-lib": "2.80.0", 26 | "constructs": "^10.0.0", 27 | "source-map-support": "^0.5.16" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/test/amundsen-cdk.test.ts: -------------------------------------------------------------------------------- 1 | import {expect as expectCDK, matchTemplate, MatchStyle } from '@aws-cdk/assert'; 2 | import {App} from 'aws-cdk-lib'; 3 | import * as SampleDbs from '../lib/sample-dbs-stack'; 4 | 5 | test('Empty Stack', () => { 6 | const app = new App(); 7 | // WHEN 8 | const stack = new SampleDbs.SampleDbsStack(app, 'MyTestStack'); 9 | // THEN 10 | expectCDK(stack).to(matchTemplate({ 11 | "Resources": {} 12 | }, MatchStyle.EXACT)) 13 | }); 14 | -------------------------------------------------------------------------------- /amazon-neptune-and-aws-cdk-for-amundsen/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2018", 4 | "module": "commonjs", 5 | "lib": [ 6 | "es2018" 7 | ], 8 | "declaration": true, 9 | "strict": true, 10 | "noImplicitAny": true, 11 | "strictNullChecks": true, 12 | "noImplicitThis": true, 13 | "alwaysStrict": true, 14 | "noUnusedLocals": false, 15 | "noUnusedParameters": false, 16 | "noImplicitReturns": true, 17 | "noFallthroughCasesInSwitch": false, 18 | "inlineSourceMap": true, 19 | "inlineSources": true, 20 | "experimentalDecorators": true, 21 | "strictPropertyInitialization": false, 22 | "typeRoots": [ 23 | "./node_modules/@types" 24 | ] 25 | }, 26 | "exclude": [ 27 | "node_modules", 28 | "cdk.out" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | sample.png 3 | .vscode 4 | yarn.lock -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | RUN apt-get update \ 4 | && apt-get install -y python3-pip python3-dev curl sudo \ 5 | && cd /usr/local/bin \ 6 | && ln -s /usr/bin/python3 python \ 7 | && pip3 --no-cache-dir install --upgrade pip \ 8 | && rm -rf /var/lib/apt/lists/* \ 9 | && curl -sL https://deb.nodesource.com/setup_current.x | sudo -E bash - \ 10 | && DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs build-essential \ 11 | && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - \ 12 | && echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list \ 13 | && sudo apt update && sudo apt install yarn 14 | 15 | 16 | COPY ./deployment/ /deployment 17 | COPY ./code/web-ui/neptune-chatbot/ /neptune-chatbot 18 | ENV FRONTEND_PATH="/neptune-chatbot" 19 | WORKDIR /deployment 20 | 21 | RUN chmod +x run.sh 22 | 23 | EXPOSE 3000 24 | 25 | CMD "/deployment/run.sh" -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/lambda-layers/Pillow.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/lambda-layers/Pillow.zip -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/lambda-layers/amazonlexbotdeploy-layer.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/lambda-layers/amazonlexbotdeploy-layer.zip -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/lambda-layers/blogparser.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/lambda-layers/blogparser.zip -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/lambda-layers/crhelper-layer.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/lambda-layers/crhelper-layer.zip -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/lambda-layers/gremlin-python-layer.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/lambda-layers/gremlin-python-layer.zip -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/lambda/blog-chatbot-blog-parser.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/lambda/blog-chatbot-blog-parser.zip -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/lambda/blog-chatbot-lex-deploy.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/lambda/blog-chatbot-lex-deploy.zip -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/lambda/blog_chatbot_author_validation.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/lambda/blog_chatbot_author_validation.zip -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/lambda/blog_chatbot_gateway.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/lambda/blog_chatbot_gateway.zip -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/lambda/chatbot-database-loader.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/lambda/chatbot-database-loader.zip -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/.gitignore: -------------------------------------------------------------------------------- 1 | #amplify 2 | amplify/\#current-cloud-backend 3 | amplify/.config/local-* 4 | amplify/mock-data 5 | amplify/backend/amplify-meta.json 6 | amplify/backend/awscloudformation 7 | build/ 8 | dist/ 9 | node_modules/ 10 | aws-exports.js 11 | awsconfiguration.json 12 | amplifyconfiguration.json 13 | amplify-build-config.json 14 | amplify-gradle-config.json 15 | amplifytools.xcconfig 16 | team-provider-info.json 17 | yarn.lock -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | .DS_Store 3 | 4 | # dependencies 5 | /node_modules 6 | /.pnp 7 | .pnp.js 8 | 9 | # testing 10 | /coverage 11 | 12 | # production 13 | /build 14 | 15 | # misc 16 | .DS_Store 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | #amplify 27 | amplify/\#current-cloud-backend 28 | amplify/.config/local-* 29 | amplify/mock-data 30 | amplify/backend/amplify-meta.json 31 | amplify/backend/awscloudformation 32 | build/ 33 | dist/ 34 | node_modules/ 35 | aws-exports.js 36 | config.json 37 | awsconfiguration.json 38 | amplifyconfiguration.json 39 | amplify-build-config.json 40 | amplify-gradle-config.json 41 | amplifytools.xcconfig 42 | -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/amplify.json: -------------------------------------------------------------------------------- 1 | { 2 | "features": 3 | { 4 | "graphqltransformer": 5 | { 6 | "transformerversion": 5 7 | }, 8 | "keytransformer": 9 | { 10 | "defaultquery": true 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/amplify/.config/project-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "neptunechatbot", 3 | "version": "3.0", 4 | "frontend": "javascript", 5 | "javascript": { 6 | "framework": "react", 7 | "config": { 8 | "SourceDir": "src", 9 | "DistributionDir": "build", 10 | "BuildCommand": "npm run-script build", 11 | "StartCommand": "npm run-script start" 12 | } 13 | }, 14 | "providers": [ 15 | "awscloudformation" 16 | ] 17 | } -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/amplify/backend/auth/cognito80d33dbf/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "identityPoolName": "neptunechatbot_identitypool_02dfaeea", 3 | "allowUnauthenticatedIdentities": true, 4 | "authSelections": "identityPoolOnly", 5 | "resourceName": "cognito80d33dbf", 6 | "authRoleArn": { 7 | "Fn::GetAtt": [ 8 | "AuthRole", 9 | "Arn" 10 | ] 11 | }, 12 | "unauthRoleArn": { 13 | "Fn::GetAtt": [ 14 | "UnauthRole", 15 | "Arn" 16 | ] 17 | } 18 | } -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/amplify/backend/backend-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "auth": { 3 | "cognito80d33dbf": { 4 | "service": "Cognito", 5 | "providerPlugin": "awscloudformation" 6 | } 7 | }, 8 | "interactions": { 9 | "neptunechatbot": { 10 | "service": "Lex", 11 | "providerPlugin": "awscloudformation", 12 | "build": true 13 | }, 14 | "booktrip": { 15 | "service": "Lex", 16 | "providerPlugin": "awscloudformation", 17 | "build": true 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/amplify/team-provider-info.json: -------------------------------------------------------------------------------- 1 | { 2 | "dev": { 3 | "awscloudformation": { 4 | "AuthRoleName": "amplify-neptunechatbot-dev-134725-authRole", 5 | "UnauthRoleArn": "arn:aws:iam::852474358610:role/amplify-neptunechatbot-dev-134725-unauthRole", 6 | "AuthRoleArn": "arn:aws:iam::852474358610:role/amplify-neptunechatbot-dev-134725-authRole", 7 | "Region": "us-west-2", 8 | "DeploymentBucketName": "amplify-neptunechatbot-dev-134725-deployment", 9 | "UnauthRoleName": "amplify-neptunechatbot-dev-134725-unauthRole", 10 | "StackName": "amplify-neptunechatbot-dev-134725", 11 | "StackId": "arn:aws:cloudformation:us-west-2:852474358610:stack/amplify-neptunechatbot-dev-134725/e69ddb80-e8ae-11ea-ac2e-06c1882c17fc", 12 | "AmplifyAppId": "d2irk1bzqjt3iu" 13 | }, 14 | "categories": { 15 | "auth": { 16 | "cognito80d33dbf": {} 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/favicon.ico -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "neptune-chatbot", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@aws-amplify/ui-react": "^0.2.16-ui-preview.14", 7 | "@material-ui/core": "^4.11.0", 8 | "@material-ui/icons": "^4.9.1", 9 | "@react-hook/window-size": "^3.0.7", 10 | "@testing-library/jest-dom": "^4.2.4", 11 | "@testing-library/react": "^9.3.2", 12 | "@testing-library/user-event": "^7.1.2", 13 | "aws-amplify": "^3.0.25-ui-preview.14", 14 | "axios": "^0.21.1", 15 | "cytoscape-cose-bilkent": "^4.1.0", 16 | "react": "^16.5.2", 17 | "react-cytoscapejs": "^1.2.1", 18 | "react-dom": "^16.5.2", 19 | "react-scripts": "3.4.4" 20 | }, 21 | "scripts": { 22 | "start": "react-scripts start", 23 | "build": "react-scripts build", 24 | "test": "react-scripts test", 25 | "eject": "react-scripts eject" 26 | }, 27 | "eslintConfig": { 28 | "extends": "react-app" 29 | }, 30 | "browserslist": { 31 | "production": [ 32 | ">0.2%", 33 | "not dead", 34 | "not op_mini all" 35 | ], 36 | "development": [ 37 | "last 1 chrome version", 38 | "last 1 firefox version", 39 | "last 1 safari version" 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/public/favicon.ico -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/public/logo192.png -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/public/logo512.png -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/App.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | import React from "react"; 4 | import "./App.css"; 5 | import Layout from "./components/Layout"; 6 | 7 | function App() { 8 | return ( 9 |
10 | 11 |
12 | ); 13 | } 14 | 15 | export default App; 16 | -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/assets/blog.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/assets/blog.ico -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/assets/logo.png -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/assets/person.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/assets/person.ico -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "SERVER_URL": "http://test" 3 | } -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 12 | monospace; 13 | } 14 | 15 | [data-id="layer0-selectbox"] { 16 | left: 0; 17 | } 18 | [data-id="layer1-drag"] { 19 | left: 0; 20 | } 21 | [data-id="layer2-node"] { 22 | left: 0; 23 | } 24 | -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/code/web-ui/neptune-chatbot/src/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | import React from "react"; 4 | import ReactDOM from "react-dom"; 5 | import "./index.css"; 6 | import App from "./App"; 7 | import * as serviceWorker from "./serviceWorker"; 8 | import Amplify from "aws-amplify"; 9 | import awsExports from "./aws-exports"; 10 | Amplify.configure(awsExports); 11 | 12 | ReactDOM.render( 13 | 14 | 15 | , 16 | document.getElementById("root") 17 | ); 18 | 19 | // If you want your app to work offline and load faster, you can change 20 | // unregister() to register() below. Note this comes with some pitfalls. 21 | // Learn more about service workers: https://bit.ly/CRA-PWA 22 | serviceWorker.unregister(); 23 | -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/deployment/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | .vscode/ -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/deployment/deploy.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: MIT-0 3 | import os 4 | import json 5 | 6 | with open(f'{os.getenv("FRONTEND_PATH")}/src/config.json', "w") as f: 7 | f.writelines(json.dumps( 8 | {"SERVER_URL": os.getenv("API_GATEWAY_INVOKE_URL")}, indent=2)) 9 | 10 | with open(f'{os.getenv("FRONTEND_PATH")}/src/aws-exports.js', "w") as f: 11 | f.write('const awsmobile = {\n') 12 | f.write(f'\taws_project_region: "{os.getenv("REGION")}",\n') 13 | f.write( 14 | f'\taws_cognito_identity_pool_id: "{os.getenv("IDENTITY_POOL_ID")}",\n') 15 | f.write(f'\taws_cognito_region: "{os.getenv("REGION")}",\n') 16 | f.write("\toauth: {},\n") 17 | f.write('\taws_bots: "enable",\n') 18 | f.write('\taws_bots_config: [{\n') 19 | f.write('\t\tname: "blog_chatbot",\n') 20 | f.write('\t\talias: "$LATEST",\n') 21 | f.write(f'\t\tregion: "{os.getenv("REGION")}"\n') 22 | f.write('}]};\n') 23 | f.write('export default awsmobile;\n') 24 | -------------------------------------------------------------------------------- /gremlin/chatbot-full-stack-application/deployment/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | python deploy.py 3 | cd ${FRONTEND_PATH} 4 | yarn start -------------------------------------------------------------------------------- /gremlin/collaborative-filtering/data/edges.txt: -------------------------------------------------------------------------------- 1 | ~id, ~from, ~to, ~label, weight:Double 2 | e1, Luke, HorizonZeroDawn, likes, 0.1 3 | e2, Luke, GranTurismoSport, likes, 0.4 4 | e3, Luke, Ratchet&Clank, likes, 0.9 5 | e4, Luke, Fifa18, likes, 0.1 6 | e5, Luke, GravityRush, likes, 0.3 7 | e6, Mike, Nioh, likes, 0.7 8 | e7, Mike, TombRaider, likes, 0.9 9 | e8, Mike, CallOfDutyBO4, likes, 0.9 10 | e9, Mike, GranTurismoSport, likes, 0.9 11 | e10, Mike, HorizonZeroDawn, likes, 0.6 12 | e11, Lina, Ratchet&Clank, likes, 0.7 13 | e12, Lina, GravityRush, likes, 0.1 14 | e13, Lina, Knack, likes, 0.2 15 | e14, Lina, TombRaider, likes, 0.2 16 | e15, Emma, Knack, likes, 0.5 17 | e16, Emma, Ratchet&Clank, likes, 0.6 18 | e17, Luke, Mario+Rabbids, likes, 0.8 19 | e18, Mike, Mario+Rabbids, likes, 0.7 20 | e19, Mike, ARMS, likes, 0.3 21 | e20, Luke, ARMS, likes, 0.5 22 | e21, Luke, MarioKart8, likes, 0.4 23 | e22, Mike, MarioKart8, likes, 0.7 24 | e23, Lina, MarioKart8, likes, 0.8 25 | e24, Lina, SuperMarioOdyssey, likes, 0.4 26 | e25, Luke, SuperMarioOdyssey, likes, 0.7 27 | e26, Mike, SuperMarioOdyssey, likes, 0.8 -------------------------------------------------------------------------------- /gremlin/collaborative-filtering/data/vertex.txt: -------------------------------------------------------------------------------- 1 | ~id,~label,GamerAlias:String,ReleaseDate:Date,GameGenre:String,ESRBRating:String,Developer:String,Platform:String,GameTitle:String 2 | Luke,person,skywalker123 3 | Emma,person,smiles007 4 | Lina,person,bringit32 5 | Mike,person,forchinet 6 | HorizonZeroDawn,game,,2017-02-28,Adventure,E,Guerrilla Games,PS4,HorizonZeroDawn 7 | GranTurismoSport,game,,2017-10-17,Racing,E,Sony Interactive Entertainment,PS4,GranTurismoSport 8 | Ratchet&Clank,game,,2016-02-17,Adventure,T,Insomniac Games,PS4,Ratchet&Clank 9 | Fifa18,game,,2017-09-29,Sports,E,Electronic Arts,PS4,Fifa18 10 | GravityRush,game,,2012-02-09,Shooter,E,Project Siren, PS4,GravityRush 11 | Nioh,game,,2017-02-07,Action,T,Team Ninja,PS4,Nioh 12 | TombRaider,game,,2016-10-11,Action,T,Square Enix,PS4,TombRaider 13 | CallOfDutyBO4,game,,2018-10-12,Shooter,M,Activision,PS4,CallOfDutyBO4 14 | Knack,game,,2013-11-15,Adventure,E,Sony Interactive Entertainment,PS4,Knack 15 | SuperMarioOdyssey,game,,2017-10-27,Adventure,E,Nintendo,Switch,SuperMarioOdyssey 16 | MarioKart8,game,,2017-4-28,Racing,E,Nintendo,Switch,MarioKart8 17 | ARMS,game,,2017-06-16,Action,E,Nintendo,Switch,ARMs 18 | Mario+Rabbids,game,,2017-08-29,Adventure,E,Ubisoft,Switch,Mario+Rabbids 19 | -------------------------------------------------------------------------------- /gremlin/collaborative-filtering/images/cloudformation-launch-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/collaborative-filtering/images/cloudformation-launch-stack.png -------------------------------------------------------------------------------- /gremlin/collaborative-filtering/images/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/collaborative-filtering/images/image1.jpg -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/athena-appearedinedges.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/athena-appearedinedges.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/athena-databasetables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/athena-databasetables.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/athena-homescreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/athena-homescreen.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/athena-namesnodes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/athena-namesnodes.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/athena-outputfiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/athena-outputfiles.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/athena-querytabs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/athena-querytabs.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/athena-tablepreview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/athena-tablepreview.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/athena-tablepreviewresults.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/athena-tablepreviewresults.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/athena-titlenodes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/athena-titlenodes.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/datamodel-erp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/datamodel-erp.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/datamodel-relational.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/datamodel-relational.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/glue-addcrawler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/glue-addcrawler.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/glue-crawlerbucket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/glue-crawlerbucket.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/glue-crawlerdatabase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/glue-crawlerdatabase.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/glue-crawleriam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/glue-crawleriam.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/glue-crawlerrun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/glue-crawlerrun.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/glue-crawlerschedule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/glue-crawlerschedule.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/glue-datagenericheaders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/glue-datagenericheaders.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/glue-datatables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/glue-datatables.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/glue-editheaders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/glue-editheaders.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/glue-fixedheaders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/glue-fixedheaders.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/neptune-clusterendpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/neptune-clusterendpoint.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/neptune-clusters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/neptune-clusters.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/neptune-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/neptune-menu.png -------------------------------------------------------------------------------- /gremlin/etl-from-relational-model/images/neptune-menuexp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/etl-from-relational-model/images/neptune-menuexp.png -------------------------------------------------------------------------------- /gremlin/glue-neptune/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /gremlin/glue-neptune/cloudformation-templates/vpc-sagemaker-stack.json: -------------------------------------------------------------------------------- 1 | { 2 | "Description": " - Amazon SageMaker VPC resources", 3 | "Parameters": { 4 | "InfrastructureID": { 5 | "Description": "Infrastructure ID", 6 | "Type": "String", 7 | "AllowedPattern": "[-a-z0-9]+", 8 | "MaxLength": 50 9 | } 10 | }, 11 | "Resources": { 12 | "SageMakerSecurityGroup": { 13 | "Type": "AWS::EC2::SecurityGroup", 14 | "Properties": { 15 | "GroupDescription": "Allow Access", 16 | "VpcId": { 17 | "Fn::ImportValue": { 18 | "Fn::Sub": "${InfrastructureID}-VPC" 19 | } 20 | }, 21 | } 22 | } 23 | }, 24 | "Outputs": { 25 | "SageMakerSecurityGroup": { 26 | "Description": "SageMaker security group", 27 | "Value": { 28 | "Ref": "SageMakerSecurityGroup" 29 | }, 30 | "Export": { 31 | "Name": { 32 | "Fn::Sub": "${InfrastructureID}-SageMakerSecurityGroup" 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /gremlin/glue-neptune/glue-neptune-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/glue-neptune/glue-neptune-architecture.png -------------------------------------------------------------------------------- /gremlin/glue-neptune/mysql-2-neptune-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/glue-neptune/mysql-2-neptune-01.png -------------------------------------------------------------------------------- /gremlin/glue-neptune/mysql-2-neptune-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/glue-neptune/mysql-2-neptune-02.png -------------------------------------------------------------------------------- /gremlin/glue-neptune/mysql-2-neptune-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/glue-neptune/mysql-2-neptune-03.png -------------------------------------------------------------------------------- /gremlin/glue-neptune/notebooks/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018. Amazon Web Services, Inc. All Rights Reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gremlin/gremlin-java-client-demo/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2029 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /gremlin/neptune-gremlin-client-demo/notebooks/force-failover.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Force failover\n", 8 | "\n", 9 | "Use this notebook to force a failover in your Neptune cluster." 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "import boto3\n", 19 | "import os\n", 20 | "\n", 21 | "client = boto3.client('neptune')\n", 22 | "\n", 23 | "response = client.failover_db_cluster(DBClusterIdentifier=os.environ['NEPTUNE_CLUSTER_ID'])\n", 24 | "\n", 25 | "if response['ResponseMetadata']['HTTPStatusCode'] == 200:\n", 26 | " print('Failover triggered')\n", 27 | "else:\n", 28 | " print(response)" 29 | ] 30 | } 31 | ], 32 | "metadata": { 33 | "kernelspec": { 34 | "display_name": "Python 3", 35 | "language": "python", 36 | "name": "python3" 37 | }, 38 | "language_info": { 39 | "codemirror_mode": { 40 | "name": "ipython", 41 | "version": 3 42 | }, 43 | "file_extension": ".py", 44 | "mimetype": "text/x-python", 45 | "name": "python", 46 | "nbconvert_exporter": "python", 47 | "pygments_lexer": "ipython3", 48 | "version": "3.7.12" 49 | } 50 | }, 51 | "nbformat": 4, 52 | "nbformat_minor": 4 53 | } 54 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/README.md: -------------------------------------------------------------------------------- 1 | # Using Amazon Neptune for analysing social media feeds 2 | 3 | This gitHub lab provides a utility code for generating a social media feeds. The code along with [this](https://aws.amazon.com/blogs/database/analyzing-social-media-feeds-using-amazon-neptune/) blogpost illustrates how to use Amazon Neptune APIs, ingest data, and query graph. Developers can use or modify the code to generate custom social media datasets. 4 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/conf/batch_import.properties: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Copyright 2017 IBM Corp. All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ############################################################################### 16 | workers = 8 17 | workers.target_record_count = 5000 18 | vertex.record_commit_count = 100 19 | edge.record_commit_count = 100 20 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/csv-conf/large_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "VertexTypes": [ 3 | { 4 | "name": "T1", 5 | "columns": { 6 | "T1-P1": {"dataType":"String","composit":true} 7 | }, 8 | "row": 10000000 9 | }, 10 | { 11 | "name": "T2", 12 | "columns": { 13 | "T2-P1": {"dataType":"String","composit":true}, 14 | "T2-P2": {"dataType":"Integer","composit":true} 15 | }, 16 | "row": 10000000 17 | }, 18 | { 19 | "name": "T3", 20 | "columns": { 21 | "T3-P1": {"dataType":"String","composit":true}, 22 | "T3-P2": {"dataType":"String","composit":true} 23 | }, 24 | "row": 10000000 25 | } 26 | 27 | ], 28 | "EdgeTypes": [ 29 | { 30 | "name": "E1", 31 | "columns": { 32 | "E1-P1": {"dataType":"Integer","composit":true} 33 | }, 34 | "relations": [ 35 | {"left": "T1", "right": "T2", "row": 10000000 } 36 | ] 37 | }, 38 | { 39 | "name": "E2", 40 | "columns": { 41 | "E2-P1": {"dataType":"Date","composit":true} 42 | }, 43 | "relations": [ 44 | {"left": "T2", "right": "T3", "row":20000000 } 45 | ] 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/csv-conf/medium_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "VertexTypes": [ 3 | { 4 | "name": "T1", 5 | "columns": { 6 | "T1-P1": {"dataType":"String","composit":true} 7 | }, 8 | "row": 1000000 9 | }, 10 | { 11 | "name": "T2", 12 | "columns": { 13 | "T2-P1": {"dataType":"String","composit":true}, 14 | "T2-P2": {"dataType":"Integer","composit":true} 15 | }, 16 | "row": 1000000 17 | }, 18 | { 19 | "name": "T3", 20 | "columns": { 21 | "T3-P1": {"dataType":"String","composit":true}, 22 | "T3-P2": {"dataType":"String","composit":true} 23 | }, 24 | "row": 1000000 25 | } 26 | 27 | ], 28 | "EdgeTypes": [ 29 | { 30 | "name": "E1", 31 | "columns": { 32 | "E1-P1": {"dataType":"Integer","composit":true} 33 | }, 34 | "relations": [ 35 | {"left": "T1", "right": "T2", "row": 1000000 } 36 | ] 37 | }, 38 | { 39 | "name": "E2", 40 | "columns": { 41 | "E2-P1": {"dataType":"Date","composit":true} 42 | }, 43 | "relations": [ 44 | {"left": "T2", "right": "T3", "row":2000000 } 45 | ] 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/csv-conf/rich/large-csv/large_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "VertexTypes": [ 3 | { 4 | "name": "T1", 5 | "columns": { 6 | "T1-P1": {"dataType":"String","composit":true} 7 | }, 8 | "row": 10000000 9 | }, 10 | { 11 | "name": "T2", 12 | "columns": { 13 | "T2-P1": {"dataType":"String","composit":true}, 14 | "T2-P2": {"dataType":"Integer","composit":true} 15 | }, 16 | "row": 10000000 17 | }, 18 | { 19 | "name": "T3", 20 | "columns": { 21 | "T3-P1": {"dataType":"String","composit":true}, 22 | "T3-P2": {"dataType":"String","composit":true} 23 | }, 24 | "row": 10000000 25 | } 26 | 27 | ], 28 | "EdgeTypes": [ 29 | { 30 | "name": "E1", 31 | "columns": { 32 | "E1-P1": {"dataType":"Integer","composit":true} 33 | }, 34 | "relations": [ 35 | {"left": "T1", "right": "T2", "row": 10000000 } 36 | ] 37 | }, 38 | { 39 | "name": "E2", 40 | "columns": { 41 | "E2-P1": {"dataType":"Date","composit":true} 42 | }, 43 | "relations": [ 44 | {"left": "T2", "right": "T3", "row":20000000 } 45 | ] 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/csv-conf/small_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "VertexTypes": [ 3 | { 4 | "name": "T1", 5 | "columns": { 6 | "T1-P1": {"dataType":"String","composit":true} 7 | }, 8 | "row": 100000 9 | }, 10 | { 11 | "name": "T2", 12 | "columns": { 13 | "T2-P1": {"dataType":"String","composit":true}, 14 | "T2-P2": {"dataType":"Integer","composit":true} 15 | }, 16 | "row": 100000 17 | }, 18 | { 19 | "name": "T3", 20 | "columns": { 21 | "T3-P1": {"dataType":"String","composit":true}, 22 | "T3-P2": {"dataType":"String","composit":true} 23 | }, 24 | "row": 100000 25 | } 26 | 27 | ], 28 | "EdgeTypes": [ 29 | { 30 | "name": "E1", 31 | "columns": { 32 | "E1-P1": {"dataType":"Integer","composit":true} 33 | }, 34 | "relations": [ 35 | {"left": "T1", "right": "T2", "row": 100000 } 36 | ] 37 | }, 38 | { 39 | "name": "E2", 40 | "columns": { 41 | "E2-P1": {"dataType":"Date","composit":true} 42 | }, 43 | "relations": [ 44 | {"left": "T2", "right": "T3", "row":200000 } 45 | ] 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/csv-conf/supernode_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "VertexTypes": [ 3 | { 4 | "name": "T1", 5 | "columns": { 6 | "T1-P1": {"dataType":"String", "composit":true} 7 | }, 8 | "row": 100 9 | }, 10 | { 11 | "name": "T2", 12 | "columns": { 13 | "T2-P1": {"dataType":"String","composit":true}, 14 | "T2-P2": {"dataType":"Integer","composit":true} 15 | }, 16 | "row": 100 17 | }, 18 | { 19 | "name": "T3", 20 | "columns": { 21 | "T3-P1": {"dataType":"String","composit":true} 22 | }, 23 | "row": 100 24 | } 25 | ], 26 | "EdgeTypes": [ 27 | { 28 | "name": "E1", 29 | "columns": { 30 | "E1-P1": {"dataType":"Date","composit":true} 31 | }, 32 | "relations": [ 33 | {"left": "T1", "right": "T2", "row": 10, "supernode":{"vertices":5, "edges":1000}}, 34 | {"left": "T2", "right": "T1", "row": 10 }, 35 | {"left": "T2", "right": "T3", "row": 10, "supernode":{"vertices":3, "edges":2000} } 36 | ] 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/csv-conf/tiny_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "VertexTypes": [ 3 | { 4 | "name": "T1", 5 | "columns": { 6 | "T1-P1": {"dataType":"String","composit":true} 7 | }, 8 | "row": 10 9 | }, 10 | { 11 | "name": "T2", 12 | "columns": { 13 | "T2-P1": {"dataType":"String","composit":true}, 14 | "T2-P2": {"dataType":"Integer","composit":true} 15 | }, 16 | "row": 10 17 | } 18 | ], 19 | "EdgeTypes": [ 20 | { 21 | "name": "E1", 22 | "columns": { 23 | "E1-P1": {"dataType":"Long","composit":true} 24 | }, 25 | "relations": [ 26 | {"left": "T1", "right": "T2", "row": 10 }, 27 | {"left": "T2", "right": "T1", "row": 10 } 28 | ] 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/doc/source/images/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/neptune-social-media-utils/doc/source/images/architecture.png -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/doc/source/images/sample_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/neptune-social-media-utils/doc/source/images/sample_output.png -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/samples/date-helper.groovy: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2017 IBM Corp. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | def createDate(year, month, day) { 18 | c = Calendar.getInstance() 19 | c.clear() 20 | c.set(year, month - 1, day, 0, 0, 0); 21 | return c.getTime() 22 | } 23 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/Main.java: -------------------------------------------------------------------------------- 1 | package com.aws.neptune; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | // write your code here 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/utils/generator/bean/BatchImporterDataMap.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.aws.neptune.utils.generator.bean; 17 | 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | public class BatchImporterDataMap { 22 | public Map> vertexMap = new HashMap<>(); 23 | public Map> edgeMap = new HashMap<>(); 24 | } 25 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/utils/generator/bean/CSVConfig.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.aws.neptune.utils.generator.bean; 17 | 18 | import java.util.List; 19 | 20 | public class CSVConfig { 21 | public List VertexTypes; 22 | public List EdgeTypes; 23 | } 24 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/utils/generator/bean/EdgeLabelBean.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.aws.neptune.utils.generator.bean; 17 | 18 | import java.util.List; 19 | 20 | public class EdgeLabelBean{ 21 | public String name = null; 22 | public String multiplicity = "MULTI"; 23 | public List signatures; 24 | public boolean unidirected = false; 25 | 26 | public EdgeLabelBean(String name, String multiplicity){ 27 | this.name = name; 28 | this.multiplicity = multiplicity; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/utils/generator/bean/EdgeTypeBean.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.aws.neptune.utils.generator.bean; 17 | 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | public class EdgeTypeBean { 22 | public String name = null; 23 | public String multiplicity = "MULTI"; 24 | public Boolean selfRef = true; 25 | public Map columns = null; 26 | public List relations = null; 27 | } 28 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/utils/generator/bean/PropertyKeyBean.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.aws.neptune.utils.generator.bean; 17 | 18 | public class PropertyKeyBean { 19 | public String name; 20 | public String dataType; 21 | public String cardinality = "SINGLE"; 22 | 23 | public PropertyKeyBean(String name, String dataType){ 24 | this.name = name; 25 | this.dataType = dataType; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/utils/generator/bean/RelationBean.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.aws.neptune.utils.generator.bean; 17 | 18 | import java.util.Map; 19 | 20 | public class RelationBean { 21 | public String left = null; 22 | public String right = null; 23 | public boolean selfRef = true; 24 | public int row = 1; 25 | public Map supernode; 26 | } 27 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/utils/generator/bean/VertexCentricIndexBean.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.aws.neptune.utils.generator.bean; 17 | 18 | import java.util.List; 19 | 20 | public class VertexCentricIndexBean{ 21 | String name = null; 22 | String edge = null; 23 | List propertyKeys; 24 | String order = "incr"; 25 | String direction = "BOTH"; 26 | } 27 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/utils/generator/bean/VertexLabelBean.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.aws.neptune.utils.generator.bean; 17 | 18 | public class VertexLabelBean{ 19 | public String name = null; 20 | public boolean partition = false; 21 | public boolean useStatic = false; 22 | public VertexLabelBean(String name) { 23 | this.name = name; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/utils/generator/bean/VertexMapBean.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.aws.neptune.utils.generator.bean; 17 | 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | public class VertexMapBean { 22 | public Map maps = new HashMap<>(); 23 | 24 | public VertexMapBean(String labelName){ 25 | this.maps.put("[VertexLabel]", labelName); 26 | this.maps.put("node_id", "node_id"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /gremlin/neptune-social-media-utils/src/main/java/com/aws/neptune/utils/generator/bean/VertexTypeBean.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.aws.neptune.utils.generator.bean; 17 | 18 | import java.util.Map; 19 | 20 | public class VertexTypeBean { 21 | public String name; 22 | public Map columns; 23 | public int row; 24 | } 25 | -------------------------------------------------------------------------------- /gremlin/neptune-streams/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /gremlin/neptune-streams/lambda/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | rm -rf target 4 | mkdir target 5 | 6 | pushd neptune-streams-demo 7 | sh build.sh 8 | popd 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /gremlin/neptune-streams/lambda/neptune-streams-demo/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | pip install virtualenv 4 | rm -rf temp 5 | virtualenv temp --python=python3.8 6 | source temp/bin/activate 7 | pushd temp 8 | pip install redis 9 | cd lib/python3.8/site-packages 10 | rm -rf certifi-* 11 | rm -rf easy_install.py 12 | rm -rf six.py 13 | cp -r ../../../../*.py . 14 | cp -r ../../../../*.zip . 15 | unzip -o neptune_python_utils.zip 16 | zip -r neptune_streams_demo.zip ./* -x "*.zip" -x "*pycache*" -x "*.so" -x "*dist-info*" -x "*.virtualenv" -x "pip*" -x "pkg_resources*" -x "setuptools*" -x "wheel*" -x "certifi*" 17 | mv neptune_streams_demo.zip ../../../../../target/neptune_streams_demo.zip 18 | deactivate 19 | popd 20 | rm -rf temp 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /gremlin/neptune-streams/lambda/neptune-streams-demo/neptune_python_utils.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/neptune-streams/lambda/neptune-streams-demo/neptune_python_utils.zip -------------------------------------------------------------------------------- /gremlin/neptune-streams/lambda/neptune-streams-demo/neptune_workload_manager.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: MIT-0 4 | ''' 5 | 6 | import os 7 | import boto3 8 | 9 | def lambda_handler(event, context): 10 | 11 | operation = event['operation'] 12 | 13 | client = boto3.client('lambda') 14 | 15 | config = client.get_function_configuration( 16 | FunctionName=os.environ['WORKLOAD_ARN'] 17 | ) 18 | 19 | env_vars = config['Environment'] 20 | 21 | if operation == 'start': 22 | print('Starting workload') 23 | env_vars['Variables']['IS_ACTIVE'] = 'True' 24 | client.update_function_configuration( 25 | FunctionName=os.environ['WORKLOAD_ARN'], 26 | Environment=env_vars 27 | ) 28 | client.invoke( 29 | FunctionName=os.environ['WORKLOAD_ARN'], 30 | InvocationType='Event' 31 | ) 32 | else: 33 | print('Stopping workload') 34 | env_vars['Variables']['IS_ACTIVE'] = 'False' 35 | client.update_function_configuration( 36 | FunctionName=os.environ['WORKLOAD_ARN'], 37 | Environment=env_vars 38 | ) 39 | 40 | -------------------------------------------------------------------------------- /gremlin/neptune-streams/notebooks/stream-viewer.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%stream_viewer" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.7.12" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 2 34 | } 35 | -------------------------------------------------------------------------------- /gremlin/ogma-neptune/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /gremlin/ogma-neptune/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018. Amazon Web Services, Inc. All Rights Reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gremlin/ogma-neptune/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Error while accessing the Graph Visualization App 4 | 5 | 6 |

Oops!! Something went wrong. Please try again. 7 | 8 | 9 | -------------------------------------------------------------------------------- /gremlin/ogma-neptune/images/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/ogma-neptune/images/architecture.png -------------------------------------------------------------------------------- /gremlin/ogma-neptune/images/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/ogma-neptune/images/image.png -------------------------------------------------------------------------------- /gremlin/ogma-neptune/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Amazon neptune + Gremlin + Ogma 7 | 8 | 12 | 16 | 21 | 22 | 23 | 24 |
25 |
26 |
27 | 28 | 34 | 35 |
36 |
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /gremlin/ogma-neptune/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "gremlin": "3.4.6", 4 | "@linkurious/ogma": "~4.1.0" 5 | }, 6 | "devDependencies": { 7 | "@rollup/plugin-node-resolve": "^13.2.1", 8 | "rollup": "^2.70.2" 9 | }, 10 | "name": "ogma-neptune", 11 | "description": "This GitHub lab will take you through hands-on exercise of visualizing graph data in Amazon Neptune using VIS.js library. Amazon Neptune is a fast, reliable, fully managed graph database service available from AWS. With Amazon Neptune you can use open source and popular graph query languages such as Apache TinkerPop Gremlin for property graph databases or SPARQL for W3C RDF model graph databases.", 12 | "version": "1.0.0", 13 | "main": "index.js", 14 | "scripts": { 15 | "build": "rollup -c" 16 | }, 17 | "author": "", 18 | "license": "MIT" 19 | } 20 | -------------------------------------------------------------------------------- /gremlin/ogma-neptune/rollup.config.js: -------------------------------------------------------------------------------- 1 | import nodeResolve from "@rollup/plugin-node-resolve"; 2 | 3 | export default { 4 | input: "./src/index.js", 5 | output: { 6 | file: "./dist/index-bundle.js", 7 | format: "iife", 8 | name: "ogmaNeptune", 9 | }, 10 | plugins: [nodeResolve()], 11 | }; 12 | -------------------------------------------------------------------------------- /gremlin/ogma-neptune/styles.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | font: 10pt arial; 4 | padding: 0; 5 | margin: 0; 6 | width: 100%; 7 | height: 100%; 8 | } 9 | 10 | #graph-container { 11 | width: 100%; 12 | height: 100%; 13 | } 14 | 15 | .ui-widget, 16 | .controls { 17 | position: absolute; 18 | top: 20px; 19 | left: 20px; 20 | z-index: 10; 21 | padding: 2em; 22 | border-radius: 1em; 23 | box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); 24 | } 25 | 26 | .controls .awesomplete > ul { 27 | max-height: 500px; 28 | overflow-y: auto; 29 | width: 300px; 30 | left: 0; 31 | right: auto; 32 | transform-origin: 50% 0; 33 | } 34 | 35 | .ui-widget { 36 | display: none; 37 | } 38 | -------------------------------------------------------------------------------- /gremlin/property-graph-data-modelling/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018. Amazon Web Services, Inc. All Rights Reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gremlin/stream-2-neptune/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /gremlin/stream-2-neptune/kinesis-2-neptune-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/stream-2-neptune/kinesis-2-neptune-architecture.png -------------------------------------------------------------------------------- /gremlin/stream-2-neptune/load-neptune.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/stream-2-neptune/load-neptune.png -------------------------------------------------------------------------------- /gremlin/stream-2-neptune/metrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/stream-2-neptune/metrics.png -------------------------------------------------------------------------------- /gremlin/stream-2-neptune/query-neptune.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/stream-2-neptune/query-neptune.png -------------------------------------------------------------------------------- /gremlin/stream-2-neptune/run-workload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/stream-2-neptune/run-workload.png -------------------------------------------------------------------------------- /gremlin/stream-2-neptune/social-app-driver/src/main/java/com/amazonaws/services/neptune/examples/social/util/ActivityTimer.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 5 | software and associated documentation files (the "Software"), to deal in the Software 6 | without restriction, including without limitation the rights to use, copy, modify, 7 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 11 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 12 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 13 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 14 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 15 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | */ 17 | 18 | package com.amazonaws.services.neptune.examples.social.util; 19 | 20 | import org.joda.time.DateTime; 21 | 22 | public class ActivityTimer implements AutoCloseable { 23 | 24 | private final long start = System.currentTimeMillis(); 25 | 26 | @Override 27 | public void close() throws Exception { 28 | System.err.println(); 29 | System.err.println(String.format("[%s] Completed in %s seconds", DateTime.now(), (System.currentTimeMillis() - start) / 1000)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /gremlin/stream-2-neptune/social-app-neptune-writer/src/main/java/com/amazonaws/services/neptune/examples/utils/RetryCondition.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 5 | software and associated documentation files (the "Software"), to deal in the Software 6 | without restriction, including without limitation the rights to use, copy, modify, 7 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 11 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 12 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 13 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 14 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 15 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | */ 17 | 18 | package com.amazonaws.services.neptune.examples.utils; 19 | 20 | public interface RetryCondition { 21 | 22 | static RetryCondition containsMessage(String msg){ 23 | return e -> e.getMessage().contains(msg); 24 | } 25 | 26 | boolean allowRetry(Throwable e); 27 | } 28 | -------------------------------------------------------------------------------- /gremlin/stream-2-neptune/social-app-neptune-writer/src/main/java/com/amazonaws/services/neptune/examples/utils/TraversalSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 5 | software and associated documentation files (the "Software"), to deal in the Software 6 | without restriction, including without limitation the rights to use, copy, modify, 7 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 11 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 12 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 13 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 14 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 15 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | */ 17 | 18 | package com.amazonaws.services.neptune.examples.utils; 19 | 20 | import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; 21 | 22 | public interface TraversalSource extends AutoCloseable { 23 | 24 | GraphTraversalSource get(); 25 | 26 | void close(); 27 | } 28 | -------------------------------------------------------------------------------- /gremlin/stream-2-neptune/social-app-neptune-writer/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{yyyy-MM-dd HH:mm:ss} %X{AWSRequestId} %-5p %c{1} - %m%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /gremlin/visjs-neptune/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018. Amazon Web Services, Inc. All Rights Reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gremlin/visjs-neptune/images/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/visjs-neptune/images/architecture.png -------------------------------------------------------------------------------- /gremlin/visjs-neptune/images/visualization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/gremlin/visjs-neptune/images/visualization.png -------------------------------------------------------------------------------- /gremlin/visjs-neptune/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "gremlin": "3.4.6" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /gremlin/visjs-neptune/visualization-error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Error while accessing the Graph Visualization App 4 | 5 | 6 |

Oops!! Something went wrong. Please try again. 7 | 8 | 9 | -------------------------------------------------------------------------------- /investment-analysis-on-edgar-using-vss/requirements.txt: -------------------------------------------------------------------------------- 1 | aws==0.2.5 2 | awscli>=1.29.61,<2.0.0 3 | boto==2.49.0 4 | boto3>=1.28.75,<1.32.0 5 | graphviz==0.20.1 6 | huggingface-hub==0.17.3 7 | langchain==0.2.3 8 | langsmith==0.0.43 9 | numpy==1.24.4 10 | pandas==2.0.3 11 | pyarrow==14.0.1 12 | requests==2.32.2 13 | scikit-learn==1.5.0 14 | scipy==1.10.1 15 | sentence-transformers==2.2.2 16 | sentencepiece==0.1.99 17 | streamlit==1.37.0 18 | streamlit-agraph==0.0.45 19 | transformers==4.38.0 20 | -------------------------------------------------------------------------------- /investment-analysis-on-edgar-using-vss/settings.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: MIT-0 3 | 4 | graphId = "" -------------------------------------------------------------------------------- /neptune-locust/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /neptune-locust/examples/bolt_locustfile.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | import logging 4 | from locust import task, run_single_user 5 | from neptune_locust.users import BoltUser, NeptuneBoltAuthToken 6 | from neo4j import GraphDatabase 7 | 8 | 9 | class Example_Bolt(BoltUser): 10 | # You can set the host explicitly here if you want to do this for debugging 11 | # host = "bolt://" 12 | 13 | def on_start(self): 14 | try: 15 | driver = GraphDatabase.driver(self.host, auth=NeptuneBoltAuthToken(self.host), encrypted=True) 16 | self.connect(driver) 17 | except ConnectionError as exception: 18 | logging.info("Caught %s", exception) 19 | self.user.environment.runner.quit() 20 | 21 | @task 22 | def task(self): 23 | resp = self.query("RETURN 1", name=self.__class__.__name__) 24 | print(resp) 25 | 26 | 27 | if __name__ == "__main__": 28 | run_single_user(Example_Bolt) 29 | -------------------------------------------------------------------------------- /neptune-locust/examples/gremlindriver_locustfile.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | from locust import task, run_single_user 4 | from neptune_locust.users import GremlinDriverUser 5 | import os 6 | 7 | 8 | class Example_GremlinDriver(GremlinDriverUser): 9 | # You can set the host explicitly here if you want to do this for debugging 10 | # host = "wss://" 11 | 12 | # Uncomment this if you want to use IAM auth 13 | # def on_start(self): 14 | # os.environ["USE_IAM"] = "true" 15 | 16 | @task 17 | def task(self): 18 | resp = self.query(self.g.inject(1), name=self.__class__.__name__) 19 | print(resp) 20 | 21 | 22 | if __name__ == "__main__": 23 | os.environ["USE_IAM"] = "true" 24 | run_single_user(Example_GremlinDriver) 25 | -------------------------------------------------------------------------------- /neptune-locust/examples/neptuneuser_gremlin_locustfile.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | from locust import task, run_single_user 4 | from neptune_locust.users import NeptuneLanguage, NeptuneUser 5 | 6 | 7 | class Example_Gremlin(NeptuneUser): 8 | # You can set the host explicitly here if you want to do this for debugging 9 | # host = "https://" 10 | 11 | @task 12 | def task(self): 13 | resp = self.query( 14 | """g.inject(1)""", 15 | name=self.__class__.__name__, 16 | language=NeptuneLanguage.GREMLIN, 17 | ) 18 | # print(resp) 19 | 20 | 21 | if __name__ == "__main__": 22 | run_single_user(Example_Gremlin) 23 | -------------------------------------------------------------------------------- /neptune-locust/examples/neptuneuser_oc_locustfile.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | from locust import task, run_single_user 4 | from neptune_locust.users import NeptuneLanguage, NeptuneUser 5 | 6 | 7 | class Example_OC(NeptuneUser): 8 | # You can set the host explicitly here if you want to do this for debugging 9 | # host = "https://" 10 | 11 | @task 12 | def task(self): 13 | resp = self.query( 14 | """RETURN 1""", 15 | name=self.__class__.__name__, 16 | language=NeptuneLanguage.OPEN_CYPHER, 17 | ) 18 | # print(resp) 19 | 20 | 21 | if __name__ == "__main__": 22 | run_single_user(Example_OC) 23 | -------------------------------------------------------------------------------- /neptune-locust/neptune_locust/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /neptune-locust/neptune_locust/users/NeptuneBoltAuthToken.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | import boto3 4 | import json 5 | from neo4j import Auth 6 | from botocore.awsrequest import AWSRequest 7 | from botocore.auth import ( 8 | SigV4Auth, 9 | _host_from_url, 10 | ) 11 | 12 | 13 | class NeptuneBoltAuthToken(Auth): 14 | """Creates the SigV4 auth with botl auth 15 | 16 | Args: 17 | Auth (Auth): The auth token 18 | """ 19 | 20 | def __init__(self, url: str, **parameters): 21 | """The init function""" 22 | 23 | creds = boto3.Session().get_credentials().get_frozen_credentials() 24 | request = AWSRequest(method="GET", url=url + "/opencypher") 25 | request.headers.add_header("Host", _host_from_url(request.url)) 26 | sigv4 = SigV4Auth(creds, "neptune-db", boto3.Session().region_name) 27 | sigv4.add_auth(request) 28 | 29 | auth_obj = { 30 | hdr: request.headers[hdr] for hdr in ["Authorization", "X-Amz-Date", "X-Amz-Security-Token", "Host"] 31 | } 32 | auth_obj["HttpMethod"] = request.method 33 | creds: str = json.dumps(auth_obj) 34 | super().__init__("basic", "username", creds, "realm", **parameters) 35 | -------------------------------------------------------------------------------- /neptune-locust/neptune_locust/users/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | from .NeptuneUser import NeptuneUser, NeptuneLanguage 4 | from .NeptuneBoltAuthToken import NeptuneBoltAuthToken 5 | from .BoltUser import BoltUser 6 | from .GremlinDriverUser import GremlinDriverUser 7 | -------------------------------------------------------------------------------- /neptune-locust/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.black] 2 | line-length = 120 3 | 4 | [project] 5 | name = "neptune_locust" 6 | version = "1.0.0" 7 | authors = [ 8 | { name="Dave Bechberger" }, 9 | ] 10 | description = "Useful plugin for Locust when working with Amazon Neptune." 11 | readme = "README.md" 12 | requires-python = ">=3.12" 13 | classifiers = [ 14 | "Programming Language :: Python :: 3", 15 | "Operating System :: OS Independent", 16 | ] 17 | license = "Apache 2" 18 | license-files = ["LICEN[CS]E*"] 19 | dependencies = [ 20 | "locust>=2.32.4", 21 | "boto3>=1.35.78", 22 | "gremlinpython>=3.7.3", 23 | "neo4j>=5.27.0" 24 | ] 25 | 26 | [build-system] 27 | requires = ["poetry-core"] 28 | build-backend = "poetry.core.masonry.api" 29 | 30 | [tool.poetry.workspaces] 31 | packages = [ 32 | "neptune_plugin" 33 | ] -------------------------------------------------------------------------------- /neptune-locust/requirements.txt: -------------------------------------------------------------------------------- 1 | aenum==3.1.15 2 | aiohappyeyeballs==2.4.4 3 | aiohttp==3.11.11 4 | aiosignal==1.3.2 5 | async-timeout==4.0.3 6 | attrs==25.1.0 7 | blinker==1.9.0 8 | boto3==1.36.10 9 | botocore==1.36.10 10 | Brotli==1.1.0 11 | build==1.2.2.post1 12 | certifi==2024.12.14 13 | charset-normalizer==3.4.1 14 | click==8.1.8 15 | ConfigArgParse==1.7 16 | Flask==3.1.0 17 | Flask-Cors==5.0.0 18 | Flask-Login==0.6.3 19 | frozenlist==1.5.0 20 | gevent==24.11.1 21 | geventhttpclient==2.3.3 22 | greenlet==3.1.1 23 | gremlinpython==3.7.3 24 | idna==3.10 25 | isodate==0.7.2 26 | itsdangerous==2.2.0 27 | Jinja2==3.1.5 28 | jmespath==1.0.1 29 | locust==2.32.8 30 | MarkupSafe==3.0.2 31 | msgpack==1.1.0 32 | multidict==6.1.0 33 | neo4j==5.27.0 34 | nest-asyncio==1.6.0 35 | packaging==24.2 36 | propcache==0.2.1 37 | psutil==6.1.1 38 | pyproject_hooks==1.2.0 39 | python-dateutil==2.9.0.post0 40 | pytz==2024.2 41 | pyzmq==26.2.1 42 | requests==2.32.3 43 | s3transfer==0.11.2 44 | setuptools==75.8.0 45 | six==1.17.0 46 | urllib3==2.3.0 47 | Werkzeug==3.1.3 48 | yarl==1.18.3 49 | zope.event==5.0 50 | zope.interface==7.2 51 | -------------------------------------------------------------------------------- /neptune-sagemaker/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT No Attribution 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /neptune-sagemaker/cdk/python/neptune-notebook/.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | package-lock.json 3 | __pycache__ 4 | .pytest_cache 5 | .venv 6 | *.egg-info 7 | 8 | # CDK asset staging directory 9 | .cdk.staging 10 | cdk.out 11 | source.bat -------------------------------------------------------------------------------- /neptune-sagemaker/cdk/python/neptune-notebook/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import os 3 | 4 | import aws_cdk as cdk 5 | 6 | from neptune_notebook.neptune_notebook_stack import NeptuneNotebookStack 7 | 8 | 9 | app = cdk.App() 10 | NeptuneNotebookStack(app, "NeptuneNotebookStack", 11 | # If you don't specify 'env', this stack will be environment-agnostic. 12 | # Account/Region-dependent features and context lookups will not work, 13 | # but a single synthesized template can be deployed anywhere. 14 | 15 | # Uncomment the next line to specialize this stack for the AWS Account 16 | # and Region that are implied by the current CLI configuration. 17 | 18 | #env=cdk.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')), 19 | 20 | # Uncomment the next line if you know exactly what Account and Region you 21 | # want to deploy the stack to. */ 22 | 23 | #env=cdk.Environment(account='123456789012', region='us-east-1'), 24 | 25 | # For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html 26 | ) 27 | 28 | app.synth() 29 | -------------------------------------------------------------------------------- /neptune-sagemaker/cdk/python/neptune-notebook/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python app.py", 3 | "watch": { 4 | "include": [ 5 | "**" 6 | ], 7 | "exclude": [ 8 | "README.md", 9 | "cdk*.json", 10 | "requirements*.txt", 11 | "source.bat", 12 | "**/__init__.py", 13 | "python/__pycache__", 14 | "tests" 15 | ] 16 | }, 17 | "context": { 18 | "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, 19 | "@aws-cdk/core:stackRelativeExports": true, 20 | "@aws-cdk/aws-rds:lowercaseDbIdentifier": true, 21 | "@aws-cdk/aws-lambda:recognizeVersionProps": true, 22 | "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true, 23 | "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, 24 | "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, 25 | "@aws-cdk/core:target-partitions": [ 26 | "aws", 27 | "aws-cn" 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /neptune-sagemaker/cdk/python/neptune-notebook/neptune_notebook/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/neptune-sagemaker/cdk/python/neptune-notebook/neptune_notebook/__init__.py -------------------------------------------------------------------------------- /neptune-sagemaker/cdk/python/neptune-notebook/requirements.txt: -------------------------------------------------------------------------------- 1 | aws-cdk-lib==2.10.0 2 | constructs>=10.0.0,<11.0.0 3 | aws-cdk.aws-neptune-alpha==2.10.0a0 -------------------------------------------------------------------------------- /neptune-sagemaker/cloudformation-templates/neptune-workbench/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | -------------------------------------------------------------------------------- /neptune-sagemaker/images/02-edge-properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/neptune-sagemaker/images/02-edge-properties.png -------------------------------------------------------------------------------- /neptune-sagemaker/images/02-edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/neptune-sagemaker/images/02-edge.png -------------------------------------------------------------------------------- /neptune-sagemaker/images/02-example-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/neptune-sagemaker/images/02-example-graph.png -------------------------------------------------------------------------------- /neptune-sagemaker/images/02-multiple-labels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/neptune-sagemaker/images/02-multiple-labels.png -------------------------------------------------------------------------------- /neptune-sagemaker/images/02-self-edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/neptune-sagemaker/images/02-self-edge.png -------------------------------------------------------------------------------- /neptune-sagemaker/images/02-vertex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/neptune-sagemaker/images/02-vertex.png -------------------------------------------------------------------------------- /neptune-sagemaker/images/03-social-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-neptune-samples/c87fcfc93a96fcdf6019f1325a0f905b23af97aa/neptune-sagemaker/images/03-social-network.png -------------------------------------------------------------------------------- /neptune-sagemaker/notebooks/util/Update-Content.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "Use this notebook to grab the latest tutorial content." 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": {}, 14 | "outputs": [ 15 | { 16 | "data": { 17 | "application/vnd.jupyter.widget-view+json": { 18 | "model_id": "8fb71fcedfe9491381fc1f15f9465639", 19 | "version_major": 2, 20 | "version_minor": 0 21 | }, 22 | "text/plain": [ 23 | "Button(description='Update notebooks', style=ButtonStyle())" 24 | ] 25 | }, 26 | "metadata": {}, 27 | "output_type": "display_data" 28 | } 29 | ], 30 | "source": [ 31 | "%run 'content.py'" 32 | ] 33 | } 34 | ], 35 | "metadata": { 36 | "kernelspec": { 37 | "display_name": "conda_python3", 38 | "language": "python", 39 | "name": "conda_python3" 40 | }, 41 | "language_info": { 42 | "codemirror_mode": { 43 | "name": "ipython", 44 | "version": 3 45 | }, 46 | "file_extension": ".py", 47 | "mimetype": "text/x-python", 48 | "name": "python", 49 | "nbconvert_exporter": "python", 50 | "pygments_lexer": "ipython3", 51 | "version": "3.6.4" 52 | } 53 | }, 54 | "nbformat": 4, 55 | "nbformat_minor": 2 56 | } 57 | -------------------------------------------------------------------------------- /neptune-sagemaker/notebooks/util/content.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from ipywidgets import widgets 3 | from IPython.display import display 4 | 5 | ''' 6 | Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | SPDX-License-Identifier: MIT-0 8 | ''' 9 | 10 | import subprocess 11 | 12 | button = widgets.Button(description='Update notebooks') 13 | display(button) 14 | 15 | def on_button_clicked(b): 16 | notebook_dir = '/home/ec2-user/SageMaker/Neptune' 17 | 18 | print('Updating helper modules...') 19 | result = subprocess.check_output(['aws', 's3', 'sync', 's3://aws-neptune-customer-samples/neptune-sagemaker/notebooks/', notebook_dir, '--exclude', '"*"', '--include', '"util/*"', '--delete']).decode("utf-8") 20 | print(result + 'Updating content...') 21 | result = subprocess.check_output(['sudo', '../../../sync.sh']).decode("utf-8") 22 | print(result + 'Done\n') 23 | 24 | 25 | button.on_click(on_button_clicked) -------------------------------------------------------------------------------- /neptune-sagemaker/notebooks/util/visualisation.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: MIT-0 4 | ''' 5 | 6 | import matplotlib.pyplot as plt; plt.rcdefaults() 7 | import numpy as np 8 | import matplotlib.pyplot as plt 9 | import pandas as pd 10 | import networkx as nx 11 | 12 | def defaultLabelFormatter(label, colors): 13 | colors.append('#11cc77') 14 | 15 | class Visualisation: 16 | def plotPaths(self, paths, formatter=defaultLabelFormatter): 17 | # Create a new empty DiGraph 18 | G=nx.DiGraph() 19 | 20 | # Add the paths we found to DiGraph we just created 21 | for p in paths: 22 | for i in range(len(p)-1): 23 | G.add_edge(p[i],p[i+1]) 24 | 25 | # Give the vertices different colors 26 | colors = [] 27 | 28 | for label in G: 29 | formatter(label, colors) 30 | 31 | # Now draw the graph 32 | plt.figure(figsize=(5,5)) 33 | nx.draw(G, node_color=colors, node_size=1200, with_labels=True) 34 | plt.show() 35 | 36 | visualisation = Visualisation() -------------------------------------------------------------------------------- /neptune-sagemaker/scripts/create-sync-notebook-script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | notebookS3Locations=$1 4 | target=$2 5 | 6 | rm -rf sync.sh 7 | 8 | printf "#!/bin/bash -ex\n\n" >> sync.sh 9 | 10 | for location in ${notebookS3Locations//,/ } 11 | do 12 | path=${location%%|*} 13 | includes="" 14 | 15 | if [[ $location = *\|* ]]; then 16 | includes=${location#*|} 17 | fi 18 | 19 | printf "aws s3 sync $path $target" >> sync.sh 20 | 21 | if [[ $includes = *[!\ ]* ]]; then 22 | printf " --exclude \"*\"" >> sync.sh 23 | fi 24 | 25 | for include in ${includes//|/ } 26 | do 27 | printf " --include \"$include\"" >> sync.sh 28 | done 29 | printf " --delete" >> sync.sh 30 | printf "\n" >> sync.sh 31 | 32 | done 33 | 34 | chmod u+x sync.sh 35 | bash sync.sh -------------------------------------------------------------------------------- /neptune-workbench-cloudformation/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | -------------------------------------------------------------------------------- /pg-schema-for-rdf/.gitignore: -------------------------------------------------------------------------------- 1 | venv/ 2 | .idea/ 3 | __pycache__/ 4 | -------------------------------------------------------------------------------- /pg-schema-for-rdf/README.md: -------------------------------------------------------------------------------- 1 | # PG-Schema for RDF 2 | 3 | This is an experiment that adds an "RDF-friendly" syntax to the [PG-Schema](https://arxiv.org/abs/2211.10962) proposal to explore possibilities for better aligment between RDF and Labeled Property Graphs (LPGs). The new PG-Schema expressions are translated to a combination of RDF Schema and [SHACL](https://www.w3.org/TR/shacl/), effectively allowing validation of RDF graphs. This experimentation provides better understanding of what RDF/LPG interoperability means, and thus supports Amazon Neptune's [OneGraph project](https://www.semantic-web-journal.net/content/onegraph-vision-challenges-breaking-graph-model-lock-0). 4 | 5 | Once presented, material from [Ora Lassila](https://www.lassila.org/)'s talk at [KGC 2024](https://www.knowledgegraph.tech/) (titled "Schema language for both RDF and LPGs") will be included here as well. 6 | 7 | ## Installation 8 | 9 | To play with _PG-Schema for RDF_, you need Python 3.10 (or newer), clone or fork the [amazon-neptune-samples](https://github.com/aws-samples/amazon-neptune-samples) repository, and then: 10 | ```shell 11 | cd pg-schema-for-rdf 12 | python3 -m venv venv 13 | source venv/bin/activate 14 | pip install -r requirements.txt 15 | ``` 16 | 17 | See the file [test/demo.py](./test/demo.py) for an example of how the system translates PG-Schema expressions to SHACL. 18 | 19 | ## License 20 | 21 | See [LICENSE](../LICENSE) for license and copyright information. 22 | -------------------------------------------------------------------------------- /pg-schema-for-rdf/requirements.txt: -------------------------------------------------------------------------------- 1 | pyparsing >= 3.1.1 2 | rdflib ~=6.3.2 3 | rdfhelpers >=0.5.2 4 | pyshacl >= 0.24.0 5 | -------------------------------------------------------------------------------- /pg-schema-for-rdf/test/demo.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from rdfpgschema import RDFTranslator 3 | 4 | if __name__ == "__main__": 5 | RDFTranslator.parse_and_translate(''' 6 | PREFIX ex: 7 | CREATE GRAPH TYPE ex:Friends STRICT IMPORTS ex:Base { 8 | (ex:Thing OPEN { ex:name xsd:string }), 9 | (ex:Person : ex:Thing & ex:Something {OPTIONAL ex:gender xsd:string}), 10 | (: ex:Person)-[ex:hasFriend { OPTIONAL ex:since xsd:date }] -> (: ex:Person) 11 | } 12 | ''').serialize(sys.stdout.buffer) 13 | --------------------------------------------------------------------------------