W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > June 2004

"How Many ..."

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Mon, 14 Jun 2004 23:13:48 +0200
To: public-rdf-dawg-comments@w3.org
Message-ID: <40d6ef12.15977985@smtp.bjoern.hoehrmann.de>

Dear RDF Data Access Working Group,

  Regarding <http://www.w3.org/TR/rdf-dawg-uc/>, I would like to suggest
a requirement that a query language provides a simple means to access
answers to "how many" questions. It is common for user interfaces to
provide such information as summary along with the information or as a
preview for the actual data.

More specifically, I would like to select the number of statements which
match certain criteria. A simple example would be a FOAF document

  [ a foaf:Person;

      foaf:name "...";
      foaf:mbox_sha1sum "...";
      foaf:made <http://example.org/a>;
      foaf:made <http://example.org/b>;
      foaf:made <http://example.org/c>;
      foaf:made <http://example.org/d>;

  ] .

And I would like to ask

  how many things are known to be foaf:made by a foaf:Person
  that has a foaf:name "..." and a foaf:mbox_sha1sum "..."

Which would result in "4" (assuming that the cited document is all
information there is). It might be possible to achieve this through
application logic, i.e., the query langauge probably offers means to
ask for the same thing without the "how many" and the implementation
might return triples in response and I could than find out how many
triples it returned, but that would not scale very well if there are
millions of items.

Another - more complicated - example would be the EARL output of the
W3C MarkUp Validator, e.g.

  http://validator.w3.org/check?uri=http%3A%2F%2Fwww.w3.org%2FProposal&output=n3
  http://validator.w3.org/check?uri=http%3A%2F%2Fwww.w3.org%2FProposal&output=earl

I would like to know how many errors were found in order to create a
XHTML document like

  http://www.bjoernsworld.de/temp/w3c-member-2004-06-07.html

This is straight-forward to do using XQuery, assuming that all W3C
members have a homepage and that there are no network errors, the
following would produce a document similar to the one above,

  declare namespace h = "http://www.w3.org/1999/xhtml";

  declare function local:errors($uri as xs:string) as xs:integer
  {
    let $val := fn:concat("http://validator.w3.org/check?uri=",
                          fn:escape-uri($uri, fn:true()),
                          "&amp;output=xml")
  
    return fn:count(fn:doc($val)/result/messages/msg)
  };
  
  <html><head><title/></head><body><table>
  {
    let $list := "http://www.w3.org/Consortium/Member/List"
    for $member in fn:doc($list)/h:html/h:body/h:ul/h:li
    return
      <tr>
        <th>{fn:string($member)}</th>
        <td>{local:errors($member/h:a/@href)}</td>
      </tr>
  }
  </table></body></html>

I would generally like to do the same thing with similar complexity
using RDF data sources, but I am not sure how much of this is in scope
of the the Data Access WG...

regards.
Received on Monday, 14 June 2004 17:14:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:47 GMT