コード例 #1
0
ファイル: ExportTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSingleNode()
        public virtual void TestSingleNode()
        {
            Node n = _gdb.createNode();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cypher.internal.javacompat.ExecutionResult result = result("node", n);
            ExecutionResult result = result("node", n);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SubGraph graph = CypherResultSubGraph.from(result, gdb, false);
            SubGraph graph = CypherResultSubGraph.From(result, _gdb, false);

            assertEquals("create (_" + n.Id + ")" + lineSeparator() + ";" + lineSeparator(), DoExportGraph(graph));
        }
コード例 #2
0
ファイル: ExportTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testEscapingStringPropertyWithBackslashAndDoubleQuote()
        public virtual void TestEscapingStringPropertyWithBackslashAndDoubleQuote()
        {
            Node n = _gdb.createNode();

            n.SetProperty("name", "Some\\\"thing");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cypher.internal.javacompat.ExecutionResult result = result("node", n);
            ExecutionResult result = result("node", n);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SubGraph graph = CypherResultSubGraph.from(result, gdb, false);
            SubGraph graph = CypherResultSubGraph.From(result, _gdb, false);

            assertEquals("create (_" + n.Id + " {`name`:\"Some\\\\\\\"thing\"})" + lineSeparator() + ";" + lineSeparator(), DoExportGraph(graph));
        }
コード例 #3
0
ファイル: ExportTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testEscapingOfNodeStringArrayPropertyValue()
        public virtual void TestEscapingOfNodeStringArrayPropertyValue()
        {
            Node n = _gdb.createNode();

            n.SetProperty("name", new string[] { "Brutus \"Brutal\" Howell", "Dr." });
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cypher.internal.javacompat.ExecutionResult result = result("node", n);
            ExecutionResult result = result("node", n);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SubGraph graph = CypherResultSubGraph.from(result, gdb, false);
            SubGraph graph = CypherResultSubGraph.From(result, _gdb, false);

            assertEquals("create (_" + n.Id + " {`name`:[\"Brutus \\\"Brutal\\\" Howell\", \"Dr.\"]})" + lineSeparator() + ";" + lineSeparator(), DoExportGraph(graph));
        }
コード例 #4
0
ファイル: ExportTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFromRelCypherResult()
        public virtual void TestFromRelCypherResult()
        {
            Node n = _gdb.createNode();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Relationship rel = n.createRelationshipTo(n, org.neo4j.graphdb.RelationshipType.withName("REL"));
            Relationship rel = n.CreateRelationshipTo(n, RelationshipType.withName("REL"));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cypher.internal.javacompat.ExecutionResult result = result("rel", rel);
            ExecutionResult result = result("rel", rel);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SubGraph graph = CypherResultSubGraph.from(result, gdb, true);
            SubGraph graph = CypherResultSubGraph.From(result, _gdb, true);

            assertEquals("create (_0)" + lineSeparator() + "create (_0)-[:`REL`]->(_0)" + lineSeparator() + ";" + lineSeparator(), DoExportGraph(graph));
        }
コード例 #5
0
ファイル: ExportTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSingleNodeWithArrayProperties()
        public virtual void TestSingleNodeWithArrayProperties()
        {
            Node n = _gdb.createNode();

            n.SetProperty("name", new string[] { "a", "b" });
            n.SetProperty("age", new int[] { 1, 2 });
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cypher.internal.javacompat.ExecutionResult result = result("node", n);
            ExecutionResult result = result("node", n);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SubGraph graph = CypherResultSubGraph.from(result, gdb, false);
            SubGraph graph = CypherResultSubGraph.From(result, _gdb, false);

            assertEquals("create (_" + n.Id + " {`age`:[1, 2], `name`:[\"a\", \"b\"]})" + lineSeparator() + ";" + lineSeparator(), DoExportGraph(graph));
        }
コード例 #6
0
ファイル: ExportTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testEscapingOfRelationshipStringArrayPropertyValue()
        public virtual void TestEscapingOfRelationshipStringArrayPropertyValue()
        {
            Node n = _gdb.createNode();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Relationship rel = n.createRelationshipTo(n, org.neo4j.graphdb.RelationshipType.withName("REL"));
            Relationship rel = n.CreateRelationshipTo(n, RelationshipType.withName("REL"));

            rel.SetProperty("name", new string[] { "Brutus \"Brutal\" Howell", "Dr." });
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cypher.internal.javacompat.ExecutionResult result = result("rel", rel);
            ExecutionResult result = result("rel", rel);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SubGraph graph = CypherResultSubGraph.from(result, gdb, true);
            SubGraph graph = CypherResultSubGraph.From(result, _gdb, true);

            assertEquals("create (_0)" + lineSeparator() + "create (_0)-[:`REL` {`name`:[\"Brutus \\\"Brutal\\\" Howell\", \"Dr.\"]}]->(_0)" + lineSeparator() + ";" + lineSeparator(), DoExportGraph(graph));
        }
コード例 #7
0
ファイル: ExportTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFromPathCypherResult()
        public virtual void TestFromPathCypherResult()
        {
            Node n1 = _gdb.createNode();
            Node n2 = _gdb.createNode();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Relationship rel = n1.createRelationshipTo(n2, org.neo4j.graphdb.RelationshipType.withName("REL"));
            Relationship rel = n1.CreateRelationshipTo(n2, RelationshipType.withName("REL"));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Path path = new org.neo4j.graphalgo.impl.util.PathImpl.Builder(n1).push(rel).build();
            Path path = (new PathImpl.Builder(n1)).push(rel).build();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cypher.internal.javacompat.ExecutionResult result = result("path", path);
            ExecutionResult result = result("path", path);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SubGraph graph = CypherResultSubGraph.from(result, gdb, true);
            SubGraph graph = CypherResultSubGraph.From(result, _gdb, true);

            assertEquals("create (_0)" + lineSeparator() + "create (_1)" + lineSeparator() + "create (_0)-[:`REL`]->(_1)" + lineSeparator() + ";" + lineSeparator(), DoExportGraph(graph));
        }
コード例 #8
0
ファイル: ExportTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testExportConstraintsViaCypherResult()
        public virtual void TestExportConstraintsViaCypherResult()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Label label = org.neo4j.graphdb.Label.label("Foo");
            Label label = Label.label("Foo");

            _gdb.schema().constraintFor(label).assertPropertyIsUnique("bar").create();
            _gdb.schema().constraintFor(label).assertPropertyIsUnique("bar2").create();
            CommitAndStartNewTransactionAfterSchemaChanges();
            Node n = _gdb.createNode(label);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cypher.internal.javacompat.ExecutionResult result = result("node", n);
            ExecutionResult result = result("node", n);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SubGraph graph = CypherResultSubGraph.from(result, gdb, true);
            SubGraph graph = CypherResultSubGraph.From(result, _gdb, true);

            assertEquals("create constraint on (n:`Foo`) assert n.`bar2` is unique;" + lineSeparator() + "create constraint on (n:`Foo`) assert n.`bar` is unique;" + lineSeparator() + "create (_0:`Foo`)" + lineSeparator() + ";" + lineSeparator(), DoExportGraph(graph));
        }
コード例 #9
0
        public static SubGraph From(Result result, GraphDatabaseService gds, bool addBetween)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final CypherResultSubGraph graph = new CypherResultSubGraph();
            CypherResultSubGraph graph = new CypherResultSubGraph();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<String> columns = result.columns();
            IList <string> columns = result.Columns();

            foreach (IDictionary <string, object> row in loop(result))
            {
                foreach (string column in columns)
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Object value = row.get(column);
                    object value = row[column];
                    graph.AddToGraph(value);
                }
            }
            foreach (IndexDefinition def in gds.Schema().Indexes)
            {
                foreach (Label label in def.Labels)
                {
                    if (graph.Labels.Contains(label))
                    {
                        graph.AddIndex(def);
                        break;
                    }
                }
            }
            foreach (ConstraintDefinition def in gds.Schema().Constraints)
            {
                if (graph.Labels.Contains(def.Label))
                {
                    graph.AddConstraint(def);
                }
            }
            if (addBetween)
            {
                graph.AddRelationshipsBetweenNodes();
            }
            return(graph);
        }