SPARQL - select from skos:category - Virtuoso 37000
Asked Answered
M

1

0

I have problem with SPARQL. I want to select something from category. For example subjects. I make query like this in http://dbpedia.org/snorql.

SELECT ?category ?subject WHERE
    {
    ?category a skos:Concept .
    ?category skos:Concept: American_punk_rock_guitarists.
    ?category dct:subject ?subject .
    } LIMIT 1000

I have error Virtuoso 37000. I don't understand why.

P.S. Is it good book for beginnier in SPARQL - Learning SPARQL, 2nd Edition Querying and Updating with SPARQL 1.1 ?

Masjid answered 3/5, 2017 at 16:16 Comment(3)
The second triple pattern is obviously wrong. Please check the syntax there.Electrotechnology
And then, you want to "select something from category,for example subjects" - this totally confusing, you're mixing things up: things that belong to a category have as subject the category. See the answer below, that's the correct way.Electrotechnology
For future reference, full error text is often more revealing than the error codes on their own. Also, at least while you're learning SPARQL, you may find it helpful to play with the drag-and-drop, graphical query builder, iSPARQL.Seline
D
3

You have at least one syntax error: the second colon (:) in the second triple.

Semantically... I don't really know the classes or predicates in dbpedia... but can skos:Concept be both a type and a predicate?

I wrote you a valid query that returns 10 members of the category "American_punk_rock_guitarists"

I put this together by going to dbpedia's faceted free text search and familiarizing myself with the concept of American punk rock guitarists, specifically Joey Ramone

 prefix dbpcat: <http://dbpedia.org/resource/Category:>

    SELECT  ?subject ?category
    WHERE
      { values ?category { dbpcat:American_punk_rock_guitarists  } .
      ?subject dct:subject ?category }
    LIMIT   10
Depressant answered 3/5, 2017 at 17:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.