Hi,
The long recent discussion(s) on the SMW users list about n-ary relations,
many-typed properties and the like got me thinking about what it would
actually take to add support to SMW for what I call n-ary relations and some
people call internal properties: properties that can be associated together
in a free-form way. Having thought about it some more, I now believe it can
be done fairly straightforwardly.
I'm going on the assumption that double-brackets and the like are on the way
out, to be replaced by parser functions, and so I'm imagining a parser
function called, say, #internal_set, that would be called in the following
way:
{{#internal_set:main_property|prop1=val1|prop2=val2|...}}
An example would be:
{{#internal_set:Is leader of|Has name=Charles de Gaulle|Has start date=1
June 1958|Has end date=8 January 1959}}
This parser function would create an "internal object" for the page from
which it was called. The first property would link between the main page and
that internal object, but - and this is important to note - it would link
*from* the internal object, *to* the main page; which seems less logical
than the other way around, but makes querying easier (and fits in with my
general philosophy that children should link to parents). The other
arguments would be all the other properties of the internal object, and
their values.
I believe that what's really needed to get all this working is a new SMW
type for "internal objects", which might be called "SMWInternalValue". Like
SMWWikiPageValue, it would allow properties pointing out from it, but unlike
SMWWikiPageValue, it wouldn't represent an actual URI in the wiki; its
printed value would just be a string that might look like "France#1" or
"France#2". And its name would never show up in queries - a query like:
{{#ask:[[Is leader of.Has continent::Europe]]|? Has name|? Has start date|?
Has end date}}
...would show the "leader" information for all countries in Europe, but it
wouldn't show the "main" column - just the three for the actual values.
(Or maybe the internal-object column should show up as well, by default - I
don't know.)
The "SMWInternalValue" would also be unique in that no properties would
point to it - it would only have its own properties, linking it to the page
it's on as well as to its other values.
So the work needed would be to create this parser function, and the
corresponding new type, and make sure that all the usual functionality -
adding, deleting, querying - worked with it.
In any case, that's my idea. Any thoughts?
-Yaron
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel