Open kkda opened 10 years ago
Isn't this the scope of the literal helper?
In general I would appreciate if we could clarify the scope of the helpers, especially:
maybe also
and
If we want others to use the site extension it would be good to have a defined set of helpers with distinguishable describing names and similar argument structures (e.g. all with one options array or something like that).
Isn't this the scope of the literal helper?
Currently, literal
helper does not support complex SPARQL queries (it only takes a property of "selected" resources); and it does not support invoking templates.
In general I would appreciate if we could clarify the scope of the helpers.
Yes, we need that.
literal
and querylist
helpers describe themselves fine (but as you guessed, scope for literal
helper may be extended, up to removal of querylist
if we want that). It looks like point of a literal
is that it works with simple properties and generates annotation markup.
literals
is just a simple way of invoking literal
with some preset options.
Proposed propertylist
is just a simple way of invoking querylist
. Currently, we have a lot of similar querylist
calls when displaying a list of properties for the selected resource, and these properties are of some complex or custom type, like http://schema.org/QuantitativeValue.
I also propose a new helper for simplifying the situation when some content (headers, wrappers) should only be present when other related generated content exists. Example usage:
<?php echo $this->propertylist(
'http://schema.org/depth',
'local/items/quantitativeValue.phtml',
array('tag' => 'dd', 'rel' => 'http://schema.org/depth')) ?>
<dt>Depth</dt>
<?php echo $this->content ?>
<?php echo $this->wrap('depth-content.phtml',
'depth-template.phtml') ?>
Maybe you have some better ideas for handling these situations.
I think using an options-array as single parameter is the best choice for the helpers.
E.g that all helpers accept either properties or complete queries we could call them with
$this->list(array('property' => 'foaf:knows'));
$this->list(array('where' => "<$this->resourceUri> foaf:knows ?person . ?person a foaf:Person ."));
The helper would check if a property is given or a where clause. We could also allow to combine property
with a limit
option.
Then we should have a template
option, which always searches in …/items/
and you never have to specify the complete path but if the template
option ends with .phtml
it is interpreted as complete path.
Furthermore we should provide default templates in OntoWiki/extensions/site/sites/items/
(as we have OntoWiki/extensions/site/sites/types/
) for plain, rdfa anotated value, link and titled resource (one of those should be default).
To get a shortcut for $this->list(array('limit' => 1))
we could also add a value-helper
Which case is not included in this?
I've added property
option to existing option array in querylist for now.
I'm for having a options array as a single argument for this helper.
We need something like this:
Which will work like this:
Any suggestions on a new helper name?