On 29/10/13 11:21, Bardo Nelgen wrote:

Thank you for the input guys – though my current version of Fuseki still
does not produce any result.

Simpify the query until it does produce something:

This part does not match your data:

?PageIRI rdf:type cnt:page .
    ?PageIRI dct:Identifier ?ucName .
    ?PageIRI dct:hasVersion ?Version .
    ?Version cnt:il8nslug ?slug .
             ^^^^^^^^^^^^

"ell" l / "one" 1 confusion.

        Andy

PS remove the { at "{?Version"  and its closing }


That said, here is the graph example I'm using:


<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#";>]>
<rdf:RDF xmlns:xsl= "http://www.w3.org/1999/XSL/Transform";
xmlns:rdf= "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
xmlns:xsd= "http://www.w3.org/2001/XMLSchema#";
xmlns:dc= "http://purl.org/dc/elements/1.1/";
xmlns:dct= "http://purl.org/dc/terms/";
xmlns:age=
"http://online-management-kontor.de/downloads/age-de-xsd-beta_110815";
xmlns:cnt= "http://namespaces.semaworx.org/content#";
xmlns:timed= "http://namespaces.semaworx.org/timed#";
 >

<!-- Single Page -->

<rdf:Description rdf:about=
"http://resources.semaworx.eu/content/pages/pageincrediblyuniqueid001";>
<rdf:type rdf:resource= "http://namespaces.semaworx.org/content#page"; />
<dct:Identifier>semawinepagehome</dct:Identifier>
<dc:creator rdf:resource=
"http://resources.semaworx.eu/ident/user#regUserxxxtheuniqueuserid001xxx"; />

<dct:created>2013-09-10T00:08:00+01:00</dct:created>
<dct:hasVersion rdf:resource=
"http://resources.semaworx.eu/timed/version#versioncrediblyuniqueid001"; />
</rdf:Description>

<!-- Single Page Version -->

<rdf:Description rdf:about=
"http://resources.semaworx.eu/timed/version#versioncrediblyuniqueid001";>
<rdf:type rdf:resource=
"http://namespaces.semaworx.org/timed#versionedContent"/>
<dct:isVersionOf rdf:resource=
"http://resources.semaworx.eu/content/pages/pageincrediblyuniqueid001"; />
<dct:format rdf:resource=
"http://purl.org/NET/mediatypes/application/xhtml+xml"; />
<cnt:pagetype>wine</cnt:pagetype>
<cnt:webapp>yes</cnt:webapp>
<dc:language>de-de</dc:language>
<dc:language>en-us</dc:language>
<dct:coverage>de</dct:coverage>
<dct:coverage>us</dct:coverage>
<age:x-content-age>14</age:x-content-age>


<cnt:i18nslug xml:lang="de-de">Startseite</cnt:i18nslug>
<cnt:i18nslug xml:lang="en-us">home</cnt:i18nslug>


<dct:title xml:lang="de-de">Weingut Bernhard Nelgen &amp; Vater</dct:title>
<dct:title xml:lang="en-us">Nelgen Winery</dct:title>
<dct:subject>Weingut Homepage / Übersicht</dct:subject>
<dct:description xml:lang="de-de">Entdecken Sie unkomplizierten Wein aus
Rheinhessen.</dct:description>
<dct:description xml:lang="en-us">The distinctively Rhine-Hessian wine
experience</dct:description>
<dct:publisher>semawine</dct:publisher>
<dc:creator rdf:resource=
"http://resources.semaworx.eu/ident/user#regUserxxxtheuniqueuserid001xxx"; />

<dct:created>2013-09-10T00:08:00+01:00</dct:created>
<dct:date>2013-09-10T00:08:00+01:00</dct:date>
<dct:hasPart rdf:resource=
"http://resources.semaworx.eu/content/elements/elementincrediblyuniqueid001";
/>
<dct:hasPart rdf:resource=
"http://resources.semaworx.eu/content/elements/elementincrediblyuniqueid002";
/>
<dct:hasPart rdf:resource=
"http://resources.semaworx.eu/content/elements/elementincrediblyuniqueid003";
/>
<timed:hasValidTimeStart rdf:datatype=
"http://www.w3.org/2001/XMLSchema#dateTime";
 >2013-10-08T15:48:21Z</timed:hasValidTimeStart>
<timed:hasValidTimeEnd rdf:datatype=
"http://www.w3.org/2001/XMLSchema#dateTime";
 >2020-09-17T15:48:24Z</timed:hasValidTimeEnd>
</rdf:Description>

</rdf:RDF>

And this is the SPARQL I am running against it (already built in your
recommendation – hopefully got hat right…):

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX cnt: <http://namespaces.semaworx.org/content#>
PREFIX timed: <http://namespaces.semaworx.org/timed#>
PREFIX age:
<http://online-management-kontor.de/downloads/age-de-xsd-beta_110815>

SELECT ?ucName ?pagetype ?revised ?mTit ?mDesc ?contentAge

WHERE {
?PageIRI rdf:type cnt:page ;
dct:Identifier ?ucName ;
dct:hasVersion ?Version .
{?Version cnt:il8nslug ?slug ;
cnt:pagetype ?pagetype ;
dct:publisher "semawine" ;
dct:date ?revised ;
dc:language "de-de" ;
dct:coverage "de" ;
age:x-content-age ?contentAge ;
dct:title ?mTit ;
dct:description ?mDesc ;
timed:hasValidTimeStart ?Start ;
timed:hasValidTimeEnd ?End .
FILTER ( ?Start < now() && now() < ?End &&
langMatches(lang(?mDesc),"de-de") && langMatches(lang(?mTit),"de-de") &&
SAMETERM(STR(?slug),"Startseite") )}
}


This delivers no result. Also tried (to minimize the chance of other
errors…) with your reduced


PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX cnt: <http://namespaces.semaworx.org/content#>

SELECT *
WHERE
{
?Version cnt:il8nslug ?slug .
FILTER(SAMETERM(STR(?slug), "home"))
}

Which did not produce any results as well.


Any additional ideas? Thanks in advance.

– Bardo


On 29.10.13 11:44, Milorad Tosic wrote:
Hi,

What you are saying is perfectly justified by the RDF/SPARQL
background theory. However, let us take a look at a practical
scalability issue for a moment.  Let us given a triplestore with N
triples where N is a large number and the two queries:
Q1:
SELECT *
WHERE
{
   ?Version cnt:il8nslug ?slug .
   FILTER(SAMETERM(STR(?slug), "home"))
}

and

Q2:
SELECT *
WHERE
{
   ?Version cnt:il8nslug "home" .
}

My believe is that complexity of the first query Q1 is O(N) while,
subject on the particular triplestore technology, complexity of the
second query Q2 is <= O(log(N)). So, regardless of being formally
equivalent, the two queries are on two different sides of feasibility
in practice.

My point here is simply to raise the flag, but not to suggest any
solution to the original question other then ones already suggested.

Regards,
Milorad



________________________________
From: Rob Vesse <[email protected]>
To: [email protected]
Sent: Tuesday, October 29, 2013 11:16 AM
Subject: Re: On how to miss a language tag


This is how the SPARQL specification does basic graph pattern matching.
Only variables act as wildcards, RDF Terms must match exactly.

So "home" only matches the literal "home", it is not considered to be
equal to "home"@en-us or any other language tagged or data typed
literal.

If you want to match regardless of language tag then you will need to
use
a variable and then a FILTER like so:

SELECT *
WHERE
{
   ?Version cnt:il8nslug ?slug .
   FILTER(SAMETERM(STR(?slug), "home"))
}

Rob

On 29/10/2013 09:27, "Bardo Nelgen"
<[email protected]> wrote:

Hello,

this time I'm asking for help with a (to meŠ) seemingly strange SPARQL
matching behavior:

When trying to match a statement using a language tag, something like

<cnt:versionedContent
rdf:about="http://resources.semaworx.eu/timed/version#versioncrediblyuniqu

eid001">
<cnt:i18nslug xml:lang="en-us">home</cnt:i18nslug>
</cnt:versionedContent>

this works quite well with

?Version cnt:i18nslug "home"@en-us .

Though, now, when I target a broader match with

?Version cnt:i18nslug "home" .

(intending to match *any* ?Version having a cnt:i18nslug named "home",
regardless of the language/locale used) it unfortunately does *not*
match *any* of the respective statements.

So: Why does leaving away the language tag in the query obviously
imply,
the result *must not* have one, rather than just ignoring the existing
one(s)?

And: How can this effect be avoided?

As always, every hint is highly appreciated.

Greets,

Bardo










Reply via email to