Re: [SMW-devel] property defined by function

2010-01-29 Thread zehetner
Hi,

I would also look into the ArrayExtension
(http://www.mediawiki.org/wiki/Extension:ArrayExtension)

If you have something like 
[[HeightLength::1;4]]
[[HeightLength::2;5]]

you can extract and assign a HeightArray and a LengthArray by queries (see
examples on extension page).

Unfortunately the ArrayExtension doesn't implement the array_map function but it
shouldn't be too difficult to add something like #arraymap which would use PHP's
array_map() function with the given parameters.

And than something along the line
{{#arraydefine:SquareArray|
{{#arraymap:HeightArray|LengthArray|'function($l,$h){return(0.5*$h*$l);}' }}
would return an array of the results.

Cheers,
Gu

Quoting Zeev Pekar z.pe...@gmail.com:

 Hi,
 
 I've just added an enhancement request:
 https://bugzilla.wikimedia.org/show_bug.cgi?id=22303
 
 Do you think it is interesting enough so that SMW developers will
 implement it? If yes, how long might it take? If no, could you please
 tell me, whether it is hard to implement such extension and which areas
 should I take a look at if I have to implement it myself (I'm new to
 SMW)?
 
 thank you in advance,
 Zeev
 
 
 --
 The Planet: dedicated and managed hosting, cloud storage, colocation
 Stay online with enterprise data centers and the best network in the
 business
 Choose flexible plans and management services without long-term contracts
 Personal 24x7 support from experience hosting pros just a phone call away.
 http://p.sf.net/sfu/theplanet-com
 ___
 Semediawiki-devel mailing list
 Semediawiki-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
 





--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


[SMW-devel] property defined by function

2010-01-28 Thread Zeev Pekar
Hi,

I've just added an enhancement request:
https://bugzilla.wikimedia.org/show_bug.cgi?id=22303

Do you think it is interesting enough so that SMW developers will
implement it? If yes, how long might it take? If no, could you please
tell me, whether it is hard to implement such extension and which areas
should I take a look at if I have to implement it myself (I'm new to
SMW)?

thank you in advance,
Zeev


--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] property defined by function

2010-01-28 Thread Hauke Pribnow
Zeev,

do you know about the ParserFunctions extension? If not, have a look at it:
http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions

You should already be able to implement something like this by using 
this extension and some templates.


Cheers,
Hauke

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] property defined by function

2010-01-28 Thread Yaron Koren
Zeev:

First, when you use Square in your examples, I'm pretty sure you actually
mean Area. Second - I think the idea of custom code for handling
functions/rules in SMW is a non-starter - too difficult to implement for too
little value. The Semantic Rules extension mentioned earlier might be able
to handle this - I haven't seen it in action, but given its name it seems
promising.

However, it seems to me that the easiest way to implement this would be,
instead of storing the formula for the area, to store the sets of allowed
values directly. This is n-ary data, so you would have two options - either
use multi-value properties, so you could have something like:

[[Has allowed value set::1;4;2]]
[[Has allowed value set::2;5;5]]
...etc.

...or use the Semantic Internal Objects extension, so you could have
something like:

{{#set_internal:Is value set for|Has height=1|Has length=4|Has area=2}}
{{#set_internal:Is value set for|Has height=2|Has length=5|Has area=5}}
...etc.

The querying would be different depending on which option you went with, but
in either case it wouldn't be that hard.

I don't know whether you can actually write out all the possibilities by
hand - it depends on your data needs. If you have hundreds or more of such
allowed-value sets, it may make sense to create a custom extension for your
wiki that would simply generate the text of these declarations, based on a
formula and a set of inputs.

-Yaron


On Thu, Jan 28, 2010 at 9:49 AM, Hauke Pribnow hauke.prib...@gmx.netwrote:

 Zeev,

 do you know about the ParserFunctions extension? If not, have a look at it:
 http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions

 You should already be able to implement something like this by using
 this extension and some templates.


 Cheers,
 Hauke


 --
 The Planet: dedicated and managed hosting, cloud storage, colocation
 Stay online with enterprise data centers and the best network in the
 business
 Choose flexible plans and management services without long-term contracts
 Personal 24x7 support from experience hosting pros just a phone call away.
 http://p.sf.net/sfu/theplanet-com
 ___
 Semediawiki-devel mailing list
 Semediawiki-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] property defined by function

2010-01-28 Thread Yaron Koren
Hi,

Has allowed value set is just an example property name - it's not a
pre-defined property; you could use any name. Sorry for the confusion.

And my strong guess is that, for this specific data need, of a specific
mathematical formula and pre-set values, you would have to have a custom
extension.

-Yaron


On Thu, Jan 28, 2010 at 3:04 PM, Zeev Pekar z.pe...@gmail.com wrote:


 
  First, when you use Square in your examples, I'm pretty sure you
  actually mean Area.
 you are right, I meant Area - its good to look up terms before using
 them.

   Second - I think the idea of custom code for handling functions/rules
  in SMW is a non-starter - too difficult to implement for too little
  value. The Semantic Rules extension mentioned earlier might be able to
  handle this - I haven't seen it in action, but given its name it seems
  promising.
 
 
  However, it seems to me that the easiest way to implement this would
  be, instead of storing the formula for the area, to store the sets of
  allowed values directly. This is n-ary data, so you would have two
  options - either use multi-value properties, so you could have
  something like:
 yes it would also be good

  [[Has allowed value set::1;4;2]]
  [[Has allowed value set::2;5;5]]
  ...etc.
 could you, please, provide a link to where I can read about Has allowed
 value set - I didn't find it on the SMW page...


 
  ...or use the Semantic Internal Objects extension, so you could have
  something like:
 
 
  {{#set_internal:Is value set for|Has height=1|Has length=4|Has
  area=2}}
  {{#set_internal:Is value set for|Has height=2|Has length=5|Has
  area=5}}
  ...etc.
 it sounds reasonable. Will I be able to query with some deviation, for
 example
 [[height=2 +/- 1]]
 [[length=5 +/- 0.5]]
 [[area = 5 +/- 3]]  ?


 
  The querying would be different depending on which option you went
  with, but in either case it wouldn't be that hard.
 
 
  I don't know whether you can actually write out all the possibilities
  by hand - it depends on your data needs. If you have hundreds or more
  of such allowed-value sets, it may make sense to create a custom
  extension for your wiki that would simply generate the text of these
  declarations, based on a formula and a set of inputs.
 In my case there are hundreds of input elements, so doing it manually is
 not an option. Do I need to program an extension in PHP or maybe it can
 be done with Semantic Rules extension, ParserFunction or something like
 that?

 thank you very much!
 Zeev

 
  -Yaron
 
 
 
  On Thu, Jan 28, 2010 at 9:49 AM, Hauke Pribnow hauke.prib...@gmx.net
  wrote:
  Zeev,
 
  do you know about the ParserFunctions extension? If not, have
  a look at it:
  http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions
 
  You should already be able to implement something like this by
  using
  this extension and some templates.
 
 
  Cheers,
  Hauke
 
 
 
 --
  The Planet: dedicated and managed hosting, cloud storage,
  colocation
  Stay online with enterprise data centers and the best network
  in the business
  Choose flexible plans and management services without
  long-term contracts
  Personal 24x7 support from experience hosting pros just a
  phone call away.
  http://p.sf.net/sfu/theplanet-com
  ___
  Semediawiki-devel mailing list
  Semediawiki-devel@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
 
 
 



--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel