在Swift中执行事务时如何读取Theo从Neo4j返回的数据?

时间:2018-05-28 19:38:48

标签: swift database neo4j cypher

我在Swift中有一个iOS应用程序,使用Theo与Neo4j数据库集成。我想从数据库中读取数据,所以我正在执行这样的事务:

let createStatement = "MATCH (n:`\(labelName)`) RETURN n"       
let resultDataContents = ["row", "graph"]
let statement = ["statement" : createStatement, "resultDataContents" : 
resultDataContents] as [String : Any]
let statements = [statement]

theo.executeTransaction(statements, completionBlock: {(response, error) in
    print("response: \(response)")
})

这是正确执行的,"响应"值与数据一起返回,但我不知道如何从中提取我需要的关系和属性。每当我打印"响应时,这就是数据的格式化方式。值:

["results": <__NSSingleObjectArrayI 0x60400000f630>(
{
    columns =     (
        n
    );
    data =     (
            {
        graph =             {
            nodes =                 (
                                    {
                    id = 0;
                    labels =                         (
                        "Carl"
                    );
                    properties =                         {
                        image = "gs://nocan-4a3d8.appspot.com/DGHSA4057-D30B-4FC2-995A-E9GASD12FCFA/-LASDFASSIGiZ7cLQhRKaK5";
                    };
                }
            );
            relationships =                 (
            );
        };
        meta =             (
                            {
                deleted = 0;
                id = 0;
                type = node;
            }
        );
        row =             (
                            {
                image = "gs://nocan-4a3d8.appspot.com/61DA4057-FSA0B-4FC2-995A-E9AF3TAFS2FCFA/-LDOIXIGiZ7cLQASDKaK5";
            }
        );
    },
            {
        graph =             {
            nodes =                 (
                                    {
                    id = 1;
                    labels =                         (
                        "Carl"
                    );
                    properties =                         {
                        note = Lgaksdlglksankgas;
                    };
                }
            );
            relationships =                 (
            );
        };
        meta =             (
                            {
                deleted = 0;
                id = 1;
                type = node;
            }
        );
        row =             (
                            {
                note = Lgaksdlglksankgas;
            }
        );
    },
            {
        graph =             {
            nodes =                 (
                                    {
                    id = 20;
                    labels =                         (
                        "Carl"
                    );
                    properties =                         {
                        note = Lkwenglkagsd;
                    };
                }
            );
            relationships =                 (
            );
        };
        meta =             (
                            {
                deleted = 0;
                id = 20;
                type = node;
            }
        );
        row =             (
                            {
                note = Lkwenglkagsd;
            }
        );
    },
            {
        graph =             {
            nodes =                 (
                                    {
                    id = 40;
                    labels =                         (
                        "Carl"
                    );
                    properties =                         {
                        image = "gs://nocan-4a3d8.appspot.com/5MAFSA4057-D30B-4FC2-995A-2DAKASD412FCFA/-LEOIXQ8MZ4lvOWvlka7";
                    };
                }
            );
            relationships =                 (
            );
        };
        meta =             (
                            {
                deleted = 0;
                id = 40;
                type = node;
            }
        );
        row =             (
                            {
                image = "gs://nocan-4a3d8.appspot.com/DGA7A4057-830B-4FC2-995A-E9ADI3DA2FCFA/-WEFDOIX5SMZ4lvOWvlka7";
            }
        );
      }
  );
}
)
, "errors": <__NSArray0 0x600000005db0>(

)
]

这甚至是什么样的物体?如何提取我需要的数据和值?我迷失了。非常感谢任何帮助或见解。

0 个答案:

没有答案