Quantcast
Channel: Planet Nemein
Viewing all articles
Browse latest Browse all 33

Multiple values for property in Content Repository

$
0
0

As part of Midgard2 PHPCR implementation, I had to resolve quite important problem: store multiple values of one object property. I provided initial solution in PHP which depends on two simple classes, few mgdschemas and one view.

Usage is as simple as:

$person = new midgard_person($personguid);
$manager = new PropertyManager($person);

$property = $manager->factory("foaf", "mbox", "<mailto:alice@wonderland.com>", "string");
$property = $manager->factory("foaf", "mbox", "<mailto:alice@real.com>", "string");

$property = $manager->getProperty("mbox", "foaf");
$values = $property->getLiterals();

$manager->save();

Once we find it useful, we can write it in Vala as part of MidgardCR RepositoryObject implementation, with some benefits:

  • GObject introspectable
  • Namespace aware which means easy to implement with RDF
  • On demand created object properties
  • "Storable" properties
  • Shared property models

Of course, in case of RepositoryObject it's up to the implementation how to store properties. So it might be SQL database, xml file, raw data, etc.


Viewing all articles
Browse latest Browse all 33

Trending Articles