Hi Rick,
there are a number of interesting approaches to this, involving both
ways to retain the metadata:

1. RDF and OWL
- basically, every node will maintain a relationship to its type node
(your shadow node), something like x?--RDF:TYPE-->type_node which
contains info on what the type is, what properties etc.

2. Neo4j Meta package (http://components.neo4j.org/neo-meta/)
- this is the concept of describing the type of things in code (Java
in this case) and thus in code enforce the restrictions and type
conversions on properties through the code. This does not capture any
meta info in the graph but is easy to do.

3. Annotate the nodes with type info
- in this approach, there is a "type" or "classname" property on any
node that is used to derive the type to deserialize/serialize the
object into, the rest of the meta info is contained in the upper code
layers. Andreas Ronges JRuby bindings are using this approach.

4. Encode everything into a String property
- this approach means shuffling everything into a string property,
basically treating properties as BLOBs. Works in some cases, but
certainly locks down your data in these properties.

What is best depends on your domain, and there might be more
approaches out there. I sense that you are asking even for an
extensible type system especially on properties. That is not in scope
of the core graph engine, but I am not sure if in theory it would be
possible to extend the property type system, we would need to discuss
that separately.

Cheers,

/peter neubauer

COO and Sales, Neo Technology

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

http://www.neo4j.org                - Relationships count.
http://gremlin.tinkerpop.com     - PageRank in 2 lines of code.



On Tue, Dec 8, 2009 at 8:43 PM, Rick Bullotta
<rick.bullo...@burningskysoftware.com> wrote:
> I can see how relationships could be used to map "is a duck." typing, but
> I'm struggling with how to infer type from properties.  In particular, while
> anything could be stuffed into a String, it loses important semantics when
> you do so.  I'm not referring to *storage* as a String, which makes plenty
> of sense - it's that the type identity of the source property is lost if you
> do so.  I could maintain a "shadow node" of the type metadata that could be
> related to each instance with a property name/property type array, but that
> seems like something that would be useful within the node model itself.
>
>
>
> Types like DateTime, hyperlinks, and so on, while quite easily storable in
> Neo4J, lose useful semantics on the way in.  I'd welcome your thoughts on
> how others have managed this type of scenario and other techniques for "meta
> tagging" nodes and properties with type or other semantic info.
>
>
>
> Thanks,
>
>
>
> Rick
>
> _______________________________________________
> Neo mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to