Sindice Forum > Sindice Services > Sindice API Support

 
Thread Tools Display Modes
  #1  
11-06-2008, 08:01 PM
taytor
Junior Member
 
Join Date: Oct 2008
Posts: 4
Problems with the Query Language

Hi all,
I need to search for all blog's posts wrote from the same author. To do it I have to use SIOC ontology. So, when I wrote this query on Advanced search form:

* <http://rdfs.org/sioc/ns#User> *

I "found about 9.62 thousand" among which an author called Fred.
But if I search for:

* <http://rdfs.org/sioc/ns#User> "Fred"

the result is Search results for advanced “* <http://rdfs.org/sioc/ns#User> "Fred"”, found 0 .

Thank you in advance.
  #2  
11-07-2008, 12:15 PM
Richard Cyganiak
Administrator
 
Join Date: May 2008
Posts: 13

Hi Taytor! The problem is that sioc:User is a class, not a property. What you are looking for is the user's name:

* <http://rdfs.org/sioc/ns#name> "Fred"

Your first query, * sioc:User *, actually shouldn't return any results AFAICT, this might be a bug on our side. I will look into this.
  #3  
11-07-2008, 12:26 PM
Renaud Delbru
Junior Member
 
Join Date: Jun 2008
Posts: 15

Hi Taytor,

yes, this is a known bug in the beta1 version.
When a triple pattern contains two wildcards, the position is not taken into account.
So, the queries
Code:
* <http://rdfs.org/sioc/ns#name> *
and
Code:
* * <http://rdfs.org/sioc/ns#name>
will return the same set of results.

The problem will be solved in beta2, which will be deployed in January. For the moment, we recommend to avoid the use of two wildcards in a single triple pattern.

Hope this help.
  #4  
11-07-2008, 12:41 PM
taytor
Junior Member
 
Join Date: Oct 2008
Posts: 4

Quote:
Originally Posted by Richard Cyganiak
Hi Taytor! The problem is that sioc:User is a class, not a property. What you are looking for is the user's name:

* <http://rdfs.org/sioc/ns#name> "Fred"

Your first query, * sioc:User *, actually shouldn't return any results AFAICT, this might be a bug on our side. I will look into this.
Thanks, and how could I search for all blog's posts wrote from the same author? In fact User is not a property, but a class. If I would search a class with a property, how should I wrote the query?
In my case I have to search for all blog's post (ant posts could be from forums or from blogs) and they have to be wrote from a User named "user".
  #5  
11-07-2008, 01:03 PM
Renaud Delbru
Junior Member
 
Join Date: Jun 2008
Posts: 15

To search all blog posts that mention triples about SIOC Users and about a resource with a certain sioc#name, you could use:

Code:
* <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User> AND * <http://rdfs.org/sioc/ns#name> "Fred"
This query shows documents that mention triples matching
Code:
* <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User>
and
Code:
* <http://rdfs.org/sioc/ns#name> "Fred"
You have to know that wildcards are not variables like in SPARQL, so the subject of the triples matching these patterns could be different. For example, the previous query will match the following document:

Code:
<http://example.org/user1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User> .
<http://example.org/user2> <http://rdfs.org/sioc/ns#name> "Fred" .
As a side note, variables will be supported in beta2.
  #6  
11-07-2008, 01:13 PM
taytor
Junior Member
 
Join Date: Oct 2008
Posts: 4

Thank you, now it works

Regards,
Sarah
  #7  
11-07-2008, 01:24 PM
Richard Cyganiak
Administrator
 
Join Date: May 2008
Posts: 13

Another approach is to make this a two-step process.

First, find out the URI (unique identifier) of authors called Fred. For this, you run the query I've given above, * sioc:name "Fred". Then, fetch the resulting RDF documents, load them all into a local RDF model, and find the URI of each author, e.g. by running this SPARQL query:

Code:
SELECT ?author WHERE {
    ?author sioc:name "Fred" .
}
This gives you the URIs of all SIOC authors named Fred. Then, for each one, you ask this query to Sindice:

Code:
* <http://rdfs.org/sioc/ns#has_creator> <xxx>
Where instead of xxx you use the author's URI. The result will be posts by that author.

Example query result for one author named Fred
  #8  
11-07-2008, 01:32 PM
taytor
Junior Member
 
Join Date: Oct 2008
Posts: 4

Okay, but the last solution founds the posts of the author from an only blog, doesn't it?

Now I have noted that the query

Code:
* <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User> AND * <http://rdfs.org/sioc/ns#name> "Fred"
founds users named Fred but not the blog's posts wrote by this username.
  #9  
11-07-2008, 02:41 PM
Richard Cyganiak
Administrator
 
Join Date: May 2008
Posts: 13

Quote:
Originally Posted by taytor
Okay, but the last solution founds the posts of the author from an only blog, doesn't it?
Right. That's why you have to repeat the query for every author.

Quote:
Now I have noted that the query

Code:
* <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User> AND * <http://rdfs.org/sioc/ns#name> "Fred"
founds users named Fred but not the blog's posts wrote by this username.
Right. That's because the user's profile (which has his name and type) is one RDF document, and each post is another RDF document. Sindice searches are always on individual documents. You cannot ask for the name and the post in the same query, because in SIOC this information is not contained in the same document.
  #10  
11-07-2008, 02:41 PM
Renaud Delbru
Junior Member
 
Join Date: Jun 2008
Posts: 15

To search all blog posts that mention triples about SIOC Users and about a resource with a certain sioc#name, you could use:

Code:
* <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User> AND * <http://rdfs.org/sioc/ns#name> "Fred"
This query shows documents that mention triples matching
Code:
* <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User>
and
Code:
* <http://rdfs.org/sioc/ns#name> "Fred"
You have to know that wildcards are not variables like in SPARQL, so the subject of the triples matching these patterns could be different. For example, the previous query will match the following document:

Code:
<http://example.org/user1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User> .
<http://example.org/user2> <http://rdfs.org/sioc/ns#name> "Fred" .
As a side note, variables will be supported in beta2.

Tags
query language, sioc

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 12:55 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.