Sign up | Lost password? | Help

My Opera news » My Opera Embraces SPARQL

My Opera Embraces SPARQL

The Opera Community is the first site that can be queried using the SPARQL language. What's that? SPARQL is a language that can be used to formulate very precise searches in the data. Not a lot of people know SPARQL, so once again Opera is on the forefront of research, and it was very enthusiastically received the research community, see for example XML.com's editor Kendall Clark's article.
We hope that people now will take the opportunity to learn it! Those who choose to do so will follow the current developments of the "Semantic Web". We think that in the future, reusing data in various contexts will happen by SPARQL queries. One blogger commented that "this should be enough to get people on the track to build GUIs and Web 2.0 stuff on top of Opera Community." Go for it! :smile:

Comments

dan1el 12. December 2005, 14:54

I really dont get this stuff no matter how many times I read it.

SerbianFighter 12. December 2005, 14:59

Congrats developers :wink:

Jere 12. December 2005, 14:59

Cool. Now if we still got a JavaScript alert() to notify about new private messages.

elcid73 12. December 2005, 15:04

Mash ups here we come! This is great.. it's a bit further beyond the scope of what I can comprehend, but I get the idea, and I look forward to testing some sample mashups using SPARQL.

froggy420 12. December 2005, 15:11

Is this the big suprise?:down:

FataL 12. December 2005, 15:11

Cool! Will try it! :up:

TomCrash 12. December 2005, 15:15

Now thats a great thing! :raider:

Maple2005 12. December 2005, 15:16

祝福伟大的Opera~
Great!

Jakub81 12. December 2005, 15:21

Great job, but Web 2.0 is a hoax!

Maple2005 12. December 2005, 15:21

祝福伟大的Opera~
Great!

elcid73 12. December 2005, 15:25

So how do we know what to query for?

Like for example, when we want to pull data about a username, how do we know to use "nick" instead of say... "username"?

Is there a listing? Or do we just query everything? Am I not asking the right questions?

elcid73 12. December 2005, 15:32

Regards to the big surprise.. I don't see how this is related to New Years, or New York... so I would wager no. Also, the posts/blogs linked to are dated in November and are talking about SPARQL as if it's not big deal, so I would wager you have some more news coming.

NoobSaibot 12. December 2005, 16:03

just in case you didn't notice here

kjetilk 12. December 2005, 16:11

elcid73: That's a very good question! For now, it requires knowledge about the model, and the various vocabularies used. For the user data, most of the data is described using FOAF, so that's how you could make a qualified guess a username is foaf:nick. The FOAF specification has also some data for images, and we use that. For the blog and forum posts, we use mostly the Dublin Core terms for titles, descriptions and contributors.

You also have the option of trying out queries and see what is returned.

But it is indeed not easy to find out and it is a topic for research now. We are a part of an international research community, and much attention is given to finding ways to automate service descriptions. Since the scale is so large, that's very important. So hang in there, we're following this very exciting field and will return with it when it is ready!

elcid73 12. December 2005, 16:32

ok kjetilk- I thought maybe there was just some concept that I wasn't grasping. Now that I know that, I feel more comfortable experimenting.

elcid73 12. December 2005, 17:35

So.. if I wanted to move this example over to my website and query opera community, how would I use the "FROM"??

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?creator ?post ?title
FROM <??????????????????>
WHERE { ?user foaf:nick "haavard" .
OPTIONAL { ?user foaf:name ?creator . }
OPTIONAL { ?post foaf:maker ?user . }
OPTIONAL { ?post dc:title ?title . }
}

NoobSaibot 12. December 2005, 18:48

i see no FROM in the examples. i guess the prefix of the datafields defines the FROM.

elcid73 12. December 2005, 18:55

Yeah there is no FROM, that's why I'm asking.

I would assume that if we are going to mash up somehow, we need to hook up to Opera to get the data?

I'm using http://www.ldodds.com/blog/archives/000213.html as an example to by... there is one example there that uses both FOAF and the Dublin Core.. I figure that is where I would start:

So the prefixes are the same as the example included here, but there is no FROM.. so how can I put this on my site?

elcid73 12. December 2005, 18:56

Also, is there going to be a specific forum created (unless I missed it) to post these questions in?

Words 12. December 2005, 19:13

I'm completely baffled by this :confused:

But if it's Opera and a first, then it's gonna be great! :hat:

NoobSaibot 12. December 2005, 20:22

elcid73: hmmm, we need a documentation of all the "columns" and "tables" we can query :smile:

hermen2048 12. December 2005, 21:00

This would be great in conjunction with an "Opera Platform" application! p:

MyFriendJack 12. December 2005, 23:26

i have no clue at all what this is about but... guess it must be great if it is encouraged by Opera.

Northgrove 13. December 2005, 09:37

For the confused, I believe it's to query websites for information using a standard language.

You ask a website a question using the SPARQL language and it gives you the answer. If widely adopted, you could e.g. ask a website for hardware drivers and it would give you the download location. Instead of navigating a site, where all sites use different layouts.

kjetilk 13. December 2005, 14:19

To clear up some confusion: First, NoobSaibot, yup that's the next step, it goes into the service description problem, a problem that is being worked on by the community.

And then, there's the FROM clause, it is not quite like the FROM of SQL. The idea is that you can name certain parts of the graph, and the FROM clause allows you to restrict the query to that part of the graph. If, I would start indexing other sites on the web and enter those data in the my.opera.com database, then I might add a name for those other sites I index and allow you to use the FROM clause to restrict your search to those sites.

For now, you don't need any FROM clause, you just use the URL
http://my.opera.com/community/sparql/sparql?query=
URL-encode your query and add it to that, and off you go! :-)
The links to the examples are URL-encoded like that.

BTW, beware that the specifications here are still working drafts, and so they still change. I don't anticipate any big changes now, but note that the namespace URI of the results has changed in the specification but not in the library, so I'm not 100% uptodate here yet.

elcid73 13. December 2005, 14:22

That's how I understand it.. but from what little I'm gathering.. the examples shown here are the opera website asking itself for information. But I can't see how to ask the opera SPARQL engine from somewhere else (which is the whole point)

That's why I asked about the "FROM" statement earlier. I'm not trying to act like I know what this is all about, but the W3C links are difficult to follow and google searching for tutorials is fruitless.. I've found a couple sites that have some samples/examples, and even a demo engine similar to what Opera has here. It's just putting all the pieces together is tough.

kjetilk 13. December 2005, 14:53

Right!

First, there is an introduction at
http://www.xml.com/pub/a/2005/11/16/introducing-sparql-querying-semantic-web-tutorial.html
which is rather good.

The main thing is that you construct URLs that will give you certain responses. Those URLs can get rather ugly. For example, the first example is simply this URL:

http://my.opera.com/community/sparql/sparql?query=PREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0ASELECT+%3Fblog+WHERE++%0D%0A++%7B+%3Fuser+foaf%3Anick+%22stephan%22+.%0D%0A++++%3Fuser+foaf%3Aweblog+%3Fblog+.+%7D%0D%0A

So, you get the results by simply visiting that URL. Now, the next thing is to use those data. That part has to happen on the web backend or in Javascript, AJAX or something like that. Since I'm a server guy, I would probably write something that would launch queries against the backend in Perl, and when getting back data, transform them using XSLT to get the data I want out to the user. It is hard to be more specific without knowing what development platforms people use. In XSLT, you can also use document()-calls, so you could possibly use that and XPath to get the data you want.

As for AJAX, there has been done quite a lot of work on this, there is a client available: http://xmlarmyknife.org/docs/rdf/sparql/ajax.html
but I'm not sure how much work would be involved in making it use the my.opera.com model. This is a very interesting development though, and it is the topic for another of Kendall Clark's articles: http://www.oreillynet.com/pub/wlg/7823

elcid73 13. December 2005, 18:42

Well all that just makes perfect sense. I was just tying to make things harder than they actually are I guess because that's what I first tried doing.

fx910 20. December 2005, 13:10

I have to admit: I just don't see the value. It's clearly far too complex for regular users, yet different enough from (ANSI) SQL to represent a steep learning curve for programmers. Why not just use a subset of SQL, or some other well-established query language (such as the "attribute:value" form that most search engines use)?

Tabris17thAngel 22. December 2005, 02:40

I've been reading through the spec, and it looks pretty sweet! I'm considering incorporating it into my senior project (though I'm not quite sure how I will just yet). ^_^;

Thanks for giving us a place to familiarize ourselves with it!

falkons54701 16. January 2006, 03:12

I have used cracker codes that resemble this, I use Linux all the time, But I run many Drives for my needs, Including Windows on one - Witch I will say is my Weekest OS, So see what this is, But I feel it's been around now that I know for about four an a half years, But you are very wright about opera its thee leader of the pack, with that I will be on my way THE FALKON

qicai02 15. June 2006, 14:28

Congrats developers !I have to admit: I just don't see the value. It's clearly far too complex for regular users, yet different enough from (ANSI) SQL to represent a steep learning curve for programmers.

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.