Hi,
I find that a *granuarly* designed AJAX UI can easily issue 100s of
queries per "page". In general, what happens is the following:
You have one query to get a list of resources
select ?person where { ?person a foaf:Person }
Then for each of these, you create a new UI part which will itself
issue several queries, one for each property
select ?name where { ?person foaf:name ?name }
select ?image where { ?person foaf:depiction ?image }
Roughly speaking, you get something like this:
HTTP message 0:
select ?person where { ?person a foaf:Person }
HTTP message 2:
select ?name where { <urn:person1> foaf:name ?name }
HTTP message 3:
select ?image where { <urn:person1> foaf:depiction ?image }
HTTP message 4:
select ?name where { <urn:person2> foaf:name ?name }
HTTP message 5:
select ?image where { <urn:person2> foaf:depiction ?image }
HTTP message 6:
select ?name where { <urn:person3> foaf:name ?name }
HTTP message 7:
select ?image where { <urn:person3> foaf:depiction ?image }
HTTP message 8:
select ?name where { <urn:person4> foaf:name ?name }
HTTP message 9:
select ?image where { <urn:person4> foaf:depiction ?image }
This has obvious performance implications in terms of perceived
performance as the page may take 10s of seconds to fully load.
I know, I know. The ideal situation would be to roll this up into one query.
HTTP message 0:
select distinct * where { ?person a foaf:Person; foaf:name ?name;
foaf:depiction ?image }
But the tradeoff is that you need to let go the granularity of the
Model on the consuming side. No more Person.getAll() and then
Person.getName(), Person.getLastName() API calls.
This is a typical problem with DAOs and Beans in the java world or any
kind of ORM in the general sense.
For most situations, however, SPARQL is expressive ( and graphy )
enough that you let go your "model" altogether and thus going with the
"one big query" is a viable options.
But sometimes you just can't, because you have a lot of business code
in between.
And, yeah, I am also removing stored procedures as a viable option (
because you might not control the SPARQL endpoint ).
So, sorry for the convolutions but I wanted to close the doors for the
obvious answers stated above.
Now, is there a way to do something like this?
HTTP message 0:
select ?person where { ?person a foaf:Person }
HTTP message 1:
select ?name where { <urn:person1> foaf:name ?name }
select ?image where { <urn:person1> foaf:depiction ?image }
select ?name where { <urn:person2> foaf:name ?name }
select ?image where { <urn:person2> foaf:depiction ?image }
select ?name where { <urn:person3> foaf:name ?name }
select ?image where { <urn:person3> foaf:depiction ?image }
select ?name where { <urn:person4> foaf:name ?name }
select ?image where { <urn:person4> foaf:depiction ?image }
and for each request get a multi-part response or something?
That would dramatically slice network costs.
Regards,
A
--
Aldo Bucchi
@aldonline
skype:aldo.bucchi
http://aldobucchi.com/
PRIVILEGED AND CONFIDENTIAL INFORMATION
This message is only for the use of the individual or entity to which it is
addressed and may contain information that is privileged and confidential. If
you are not the intended recipient, please do not distribute or copy this
communication, by e-mail or otherwise. Instead, please notify us immediately by
return e-mail.