If you put this in a property page

[[has type::page]]
{{#arraymap:{{#ask: [[Category:RANGE]]|format=list|link=none|sep=,}}|,|
@@|[[allows value::@@]]}}

then it expands to define the range of that property as the members of
category RANGE, you could add more conditions to the #ask query to get
any more complex range definition. and you could have multiple queries
unioned together if you seperate them by commas {{#ask...query1}},
{{#ask...query2}}. No implementation of Domain yet but I feel like
that is less important. - I did try halo extension and they have a
partial implementation of domain and range but you can't use semantic
forms with it, I don't think.


I am also using this kind of technique to allow for property inversion
(see Template:inverse below), but you have to define it on the
instance page where you are assigning the property, and not the
property page and it is not 100% stateless but seems to depend on
whether you have edited and saved the page recently...

<Template:inverse:start/>
<noinclude><pre>
USAGE
put on a page (or in a template) where a property is defined to also
add the inverted property
{{inverse|p = property|p' = inverse|display = none/inline/list}}
(defaults to list)

e.g.
{{inverse
|p =has child
|p' =has parent
}}

then if x [[has child::y]], and you place this template in page y,
then y is defined [[has parent::x]]
</pre></noinclude>
<includeonly>{{#ifeq:{{{display}}}|none|<div
style="display:none">{{#arraymap:{{#ask: [[{{{p}}}::{{FULLPAGENAME}}]]
| format=list | link=none | sep=,}}|,|@@|[[{{{p'}}}::@@]]|}}</div>|
{{#ifeq:{{{display}}}|inline|{{#arraymap:{{#ask: [[{{{p}}}::
{{FULLPAGENAME}}]] | format=list | link=none | sep=,}}|,|@@|
[[{{{p'}}}::@@]]|, }}|<ul>{{#arraymap:{{#ask: [[{{{p}}}::
{{FULLPAGENAME}}]] | format=list | link=none | sep=,}}|,|@@|
<li>[[{{{p'}}}::@@]]</li>|}}</ul>}}}}</includeonly>
<Template:inverse:end/>
In terms of illegibility and incomprehensibility this is currently my
favourite template :-)


I was going to try and contribute this knowledge to the semantic
mediawiki user guide but I couldn't work out how to get contributors
rights. Anyone know where I should put this kind of thing?

Cheers,

Rob.

On Sep 30, 6:51 pm, Patrick Nagel <[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Guy,
>
> > Is there a way of populating 'Allows Value' lists dynamically, from the
> > result of a query?  I've come accross a number of situations where such
> > functionality would be useful, but have so far not found any way of
> > achieving it.
>
> This is more a SMW question, I think... Perhaps this helps you (I started the
> thread a few weeks ago):
>
> http://www.nabble.com/Share-an-%27Allows-value%27-list-between-proper...
>
> Patrick.
>
> - --
> Key ID: 0x86E346D4            http://patrick-nagel.net/key.asc
> Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iEYEARECAAYFAkjiZyEACgkQyYHmhobjRtQ/vgCeOezAZ+Gq2cSXxOj9Fi/ngwlS
> uBwAoIb8vylMsqX1bgBH27HlZUOzxNvg
> =dtyJ
> -----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Semantic Forms" group.
To post to this group, send email to semantic-forms@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/semantic-forms?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to