XUL Talk:Templates Plan
From MozillaWiki
Contents
Comments User:Conor325
Enhanced builder
Fresnel is SIMILE's RDF query mechanism. It builds on SPARQL or XPath and provides query modularization. To allow for a fully functional Fresnel Query Processor, the builder and result interfaces would have to be enhanced.
- Fresnel supports "get-all" where you can get the values of all of the predicates of an object or all but a particular group. I imagine that most query mechanisms have this facility - SPARQL does too in a round about way. Problem is that the XUL Builder doesn't support this. It needs explicit names for all the predicate values it receives. It can't just walk a result object using value="?*" or some such wildcard.
- Fresnel supports label attachment for values so for example, if you get a value for the predicate "http:.../wife" of say "Mary", you can also attach the label "Wife" to Mary for the builder to use. By default that label comes from OWL. The result object, TemplateResult passed from the Query processor to Builder doesn't have a slot for "label". Without it, you loose one of the nicest features of a Fresnel processor or similar OWL-aware Query Processor.
Finally, you will never be able to build in support for all the sort criteria people have. Can sort be enhanced to take a sort function, say a simple comparison function that would tell you if one row were less than another. This way, a developer can insert custom sorting for elements.
Query Processor to Builder interface
The Template result interface needs to be updated. It should not mention "resources" or other RDF specifics. If a dataSource can be SQL or plain XML then it must be RDF-independent.
Built-in RDF Query Processor
- RDF caching and refresh: Neil pointed out that RDF refresh was implemented last year and it can be called from remote code. However, RDF caching is still an issue. Refresh and caching is a general issue for all "file based" data sources i.e. where they is a load at startup and subsequent queries run off a local cache.
- RDF templates and RDF loading: a big shortcoming of rdf templates now is that they seem to load data sources synchronously (Neil pointed out to me that this is just an impression - they actually load asynchronously but so fast that they block the browser anyway). A large file certainly blocks the browser. They seem to load the datasource as part of template parsing which doesn't allow a page to register as a builder listener and so catch when the first build of an element completes. As part of version 2, I think loading shouldn't block the browser (some timer stuff or what?) and there should be an event like "datasourceLoaded" to mark its end.
- literal display: the current template mechanism doesn't display a literal predicate's value if you are quering a particular resource (you must embed literals in blank nodes). SPARQL for one let's you grab such a literal. For example, SELECT ?name WHERE { :people/p1 foaf:name ?name } gets the name (literal) of a particular resource (the person ":people/p1"). The built-in RDF Query should support this too.