[deepamehta-devel] Arrays in DeepaMehta

Jörg Richter jri at deepamehta.de
Do Jan 30 22:46:39 CET 2014

You can store Java arrays natively in DM topics and associations. Try the DM Property API. Properties are arbitrary key/value pairs you can get/set for any topic/association. Any topic/association can have an arbitrary number of properties.

    Object getProperty(String propUri);
    void setProperty(String propUri, Object propValue, boolean addToIndex);
    boolean hasProperty(String propUri);
    void removeProperty(String propUri);

As key ("propUri") you can specify any string, however, you should namespace your keys in order to avoid clashes with other plugins. The "dm4." namespace is reserved for the standard plugins. As "propValue" you can specify any primitive Java object (plus String) or an *array* of primitive Java objects (plus String). Null values are not allowed.

Furthermore when you set the "addToIndex" flag you can use the Core Service's property-based retrieval methods.

    List<Topic> getTopicsByProperty(String propUri, Object propValue);
    List<Topic> getTopicsByPropertyRange(String propUri, Number from, Number to);
    List<Association> getAssociationsByProperty(String propUri, Object propValue);
    List<Association> getAssociationsByPropertyRange(String propUri, Number from, Number to);

Range-based retrieval is supported only for numeric property values.


On Jan 29, 2014, at 20:18, Jörn Weißenborn wrote:

> Hi,
> what is good way of storing an array or better an (arbitrary dimensional) matrix in Deepamehta?
> As a scientist, most of my data consist of such thinks, sometimes with millions of entries. I think, 
> the most efficient way to deal with it is storing a given array by converting it to a binary blob and then feed it to dm by casting it as string. When I later access it via a client, I need to cast it back (which implies that an array type topic would also need to hold information about how to recast, int16 or uint32 or float64).
> What do you think about this problem?
> Best,
> Joern
> _______________________________________________
> deepamehta-devel mailing list
> deepamehta-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/deepamehta-devel

Mehr Informationen über die Mailingliste devel