On 12/30/2013 03:54 PM, Huston Hedinger wrote:
> Michael, Wes, et all...
>
> Lots of good ideas hear in regards to how to handle and manipulate
> JSON directly in Cypher... The UDF direction seems really promising -
> especially as cypher becomes more and more powerful. Additionally, we
> have a couple use cases where we have stored entire JSON objects as
> strings.
Of course, this is _exactly_ what I'm doing. My strings will sometimes
run over 60K bytes. Perhaps as large as 250K... (but not typically).
So, at least I'm not alone ;-)
> A straightforward use case would be an "address" property. I might
> want to store "address" on a node, and then nested I would have
> "street", "city", "etc."... So the object might like like (some_node
> {"address": { "city": "New York", "street": ..., "number":...,
> etc.}..}) Obviously, a great way to deal with addresses in a graph is
> as hierarchies - but not every use case demands such a robust
> represenation of the data. Nested key/values is a great short cut.
>
> On another note - we've taken an initial stab at a generalized
> GraphJSON format - to be used as a data interchange (mainly for the
> UI) and in a similiar vein to Nigel's Geoff within py2neo. This is
> not too dissimilar from GraphSON (blueprints) or GEXF (an xml format
> for Graphs). Additionally, we are drawing heavy inspiration from
> GeoJSON which is a standardized format form representating (you
> guessed it) map related data. From a user standpoint I'd love to see
> an "Export as GraphJSON" in the browser or "RETURN GraphJSON(nodes)"
> or even "RETURN GraphJSON(some_path)" directly in cypher. The
> current "Export JSON" method in the browser is great, and I look
> forward to seeing Neo build on that.
>
> A draft/Alpha version of the specs are at www.GraphJSON.org
> <http://www.GraphJSON.org%20>- You an build GraphJSON documents at
> GraphJSON.io <http://GraphJSON.io>... Experimental at best.
>
> Thoughts?
>
>
>
> On Saturday, December 7, 2013 1:58:29 AM UTC-8, Michael Hunger wrote:
>
> Let's move this whole discussion to the google group :)
>
> Map support for properties is planned and almost made it into the
> product some time ago but then were some considerations so that it
> sadly didn't work out.
>
> User defined functions would be a way to go but much better with
> real support by the storage engine and language.
>
> Wes, didn't you want to look into a UDF PoC?
>
> Michael
>
> Am 07.12.2013 um 05:22 schrieb Wes Freeman <[email protected]
> <javascript:>>:
>
>> I don't think it would be easy in a plugin unless you did some
>> weird stuff intercepting the cypher. On the other hand, might be
>> an interesting use case for a user defined function--something
>> that takes a JSON string and returns a map. Actually--that might
>> be general purpose enough to go into Cypher itself, especially
>> since Cypher does have map support.
>>
>> Wes
>>
>> On Fri, Dec 6, 2013 at 10:48 PM, Alan Robertson <[email protected]
>> <javascript:>> wrote:
>>
>> Yes.
>>
>> It's not rocket science. It's not always cheap, and it's
>> major stinky, but it works for me ;-)
>>
>> And cypher doesn't offer it, then I have to do the filtering
>> in the output from cypher, which can suck much worse than
>> that ;-).
>>
>> Maybe a skanky plugin that does it ;-)
>>
>> See even simple maps aren't enough for me in all cases...
>>
>> When I discover the network topology of a server -- NICs, and
>> IP addresses, and MAC addresses, and speeds, and MTUs and all
>> that stuff, it gets pretty complicated...
>>
>> Similar things happen when I discover all the service/client
>> information...
>>
>> One nice thing about storing it as a string -- I can easily
>> tell if anything has changed (my nanoprobes can ensure that
>> the JSON comes back in "canonical" form) just by doing a
>> string compare ;-).
>>
>> If it's the same, then I don't have to walk the graph to
>> figure out what has changed...
>>
>>
>>
>>
>> On 12/06/2013 07:59 PM, Wes Freeman wrote:
>>> That's an interesting idea--you mean automatic parsing of
>>> string-based JSON in cypher props? I wish they would just
>>> offer map property support in Neo. It's not "pure", but it
>>> sure would be handy.
>>>
>>> Wes
>>>
>>> On Fri, Dec 6, 2013 at 9:44 PM, Alan Robertson
>>> <[email protected] <javascript:>> wrote:
>>>
>>> Hi,
>>>
>>> Something I added to my own code which is working out
>>> quite nicely is
>>> support for JSON-formatted string attributes in nodes.
>>>
>>> So, you can say things like
>>> node.get('JSON_fieldname.somejsonfield.someotherfield[1]')
>>> and have it
>>> work. This node has a JSON-formatted string named
>>> "JSON_fieldname".
>>> The JSON in the string looks something like this:
>>> {"somejsonfield:{"someotherfield":[1,2,3]}}
>>>
>>> It would surely be nice if there were some way of
>>> supporting this in Cypher.
>>>
>>> It doesn't have to be as uniform and pretty as what I
>>> showed, but having
>>> some way to do this would be very nice.
>>>
>>> I have had little choice but to shove lots of data into
>>> my nodes as JSON
>>> strings - and it works pretty well. But not for Cypher.
>>>
>>> By the way, one nice thing I can do in python is to say
>>> node.get('JSON_fieldname.somejsonfield.someotherfield[-1]')
>>> to refer to
>>> the last element of the array, and similarly for -2 and
>>> -3...
>>>
>>> --
>>> Alan Robertson <[email protected]> <javascript:> - @OSSAlanR
>>>
>>> "Openness is the foundation and preservative of
>>> friendship... Let me claim from you at all times your
>>> undisguised opinions." - William Wilberforce
>>>
>>>
>>
>>
>> --
>> Alan Robertson <[email protected]> <javascript:> - @OSSAlanR
>>
>> "Openness is the foundation and preservative of friendship... Let
>> me claim from you at all times your undisguised opinions." - William
>> Wilberforce
>>
>>
>
--
Alan Robertson <[email protected]> - @OSSAlanR
"Openness is the foundation and preservative of friendship... Let me claim
from you at all times your undisguised opinions." - William Wilberforce
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.