0

Is it possible to perform a sparql construct out of a Where clause on a remote enpoint ?

CONSTRUCT { ?idbcountry skos:definition ?def . }

WHERE {

            ?idbcountry a skos:Concept .
            ?idbcountry rdfs:label ?label .
            FILTER(lang(?label) = "en") 

    Service <http://dbpedia.org/sparql> {
                ?s a <http://dbpedia.org/ontology/Country> .
                ?s rdfs:label ?label .
                ?s rdfs:comment ?def
                FILTER(lang(?label) = "en")
                FILTER(lang(?def) = "en")
    }
}
MaatDeamon
  • 9,532
  • 9
  • 60
  • 127
  • Yes. Are you running into some problem when you try this? If so, what? – Joshua Taylor May 05 '15 at 18:54
  • 1
    Also, don't do `lang(...) = "en"`. Use `langMatches(lang(...),"en")`. – Joshua Taylor May 05 '15 at 18:55
  • As the select version of the query worked and i could visualize that the result was good, i ended up simply using the Insert Version of the query and it worked. – MaatDeamon May 06 '15 at 15:14
  • Maybe it is the TopBraid Sparql Editor, but my syntax just does not go through. – MaatDeamon May 06 '15 at 15:16
  • Found the problem and it is due to the TopBraid editor. Issue of spacing. The Where and Construct shoud not have more than two lines that separate them. and other things like that .... – MaatDeamon May 06 '15 at 15:33
  • Thank you for the tip lang(...) = "en". Use langMatches(lang(...),"en"). But could you explain why ? – MaatDeamon May 06 '15 at 15:34
  • Sure; language codes can have additional country extensions. E.g., see the second part of [this answer](http://stackoverflow.com/a/29080358/1281433). You can have two literals, e.g., "Cette Série des Années Soixante-dix"@fr and "Cette Série des Années Septante"@fr-BE, that are both French, but lang(...) = "fr" will only match the first, whereas langMatches(lang(...),"fr") will match both of them. Most of the time you'd want all entries with the specific language, not just those without country codes. – Joshua Taylor May 06 '15 at 15:37
  • You should post the issue with TopBraid as an answer and mark it as accepted, or delete the question. – Joshua Taylor May 07 '15 at 12:53

1 Answers1

0

I Found the problem and it is due to the TopBraid editor. It is an Issue of spacing. The Where and Construct shoud not have more than two lines that separate them..... There few other corner case of spacing. More generally spacing is important in TopBraid Sparql editor.

Hence the query was ok.

MaatDeamon
  • 9,532
  • 9
  • 60
  • 127