neo4jphp icon indicating copy to clipboard operation
neo4jphp copied to clipboard

Support new GEOFF syntax

Open jadell opened this issue 13 years ago • 4 comments

http://py2neo.org/geoff/

Also, the GEOFF extension: https://github.com/neo4j/neo4j-geoff

Consider deprecating or removing the client-side GEOFF implementation.

jadell avatar Jan 14 '12 23:01 jadell

Damn, beat me to it... was going to raise this as an issue! :-P

technige avatar Jan 20 '12 23:01 technige

Yeah, I knew it was going to have to happen. What I'll probably end up doing is checking to see if the extension is available and forwarding to that if it is, otherwise parse it on the client side. I may have to change the API around a bit, but I don't think many people are using it in Neo4jPHP, so it hopefully won't affect too many users.

jadell avatar Jan 21 '12 01:01 jadell

That's basically what I do in py2neo:

    def load(self, file, **params):
        if self.graph_db._geoff_uri is None:
            batch = self.compile(file, **params)
            results = batch.submit()
            return neo4j.Node(results[batch.first_node_id]['location'])
        else:
            response = graph_db._post(
                graph_db._geoff_uri,
                {'rules': file.read(), 'params': dict(params)}
            )
            return response['params']

On construction of a GraphDatabaseService instance, I query the extensions and store recognisable URIs. In this case the Geoff plugin URI is stored in graph_db._geoff_uri so it's a simple case of checking whether or not that has a value.

Feel free to rip off my code as much as you like :-)

technige avatar Jan 21 '12 09:01 technige

I plan to :-)

jadell avatar Jan 21 '12 16:01 jadell