Hello Andy, can you confirm that this is a bug ? Should I contruct a minimal example ?
Regards,
Michael Brunnbauer
On Wed, Jul 17, 2013 at 09:06:49PM +0200, Michael Brunnbauer wrote:
>
> Hello Andy,
>
> the second query is the first query with "select ?c where {" and "}" around
> it.
> I don't understand why it should return something else.
>
> Our SPARQL endpoints are public anyway so you can see yourself. The numbers
> may change a bit due to user activity:
>
> http://www.imagesnippets.com/sparql/dbpedia
>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> select (count(*) as ?c) where { graph ?g {
> SERVICE <http://www.imagesnippets.com/sparql/datasets> { ?d rdfs:subClassOf
> <http://www.imagesnippets.com/imgtag/datasets/Michaels_Dataset/aidkjfsdf>. }
> ?s ?p ?d.
> }
> }
>
> Result: 1
>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> select (count(distinct ?g) as ?c) where { graph ?g {
> SERVICE <http://www.imagesnippets.com/sparql/datasets> { ?d rdfs:subClassOf
> <http://www.imagesnippets.com/imgtag/datasets/Michaels_Dataset/aidkjfsdf>. }
> ?s ?p ?d.
> }
> }
>
> Result: 1
>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> select ?c where {
> select (count(*) as ?c) where { graph ?g {
> SERVICE <http://www.imagesnippets.com/sparql/datasets> { ?d rdfs:subClassOf
> <http://www.imagesnippets.com/imgtag/datasets/Michaels_Dataset/aidkjfsdf>. }
> ?s ?p ?d.
> }
> }
> }
>
> Result: 12347 (=The number of all triples in all named graphs)
>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> select ?c where {
> select (count(distinct ?g) as ?c) where { graph ?g {
> SERVICE <http://www.imagesnippets.com/sparql/datasets> { ?d rdfs:subClassOf
> <http://www.imagesnippets.com/imgtag/datasets/Michaels_Dataset/aidkjfsdf>. }
> ?s ?p ?d.
> }
> }
> }
>
> Result: 1160 (=The number of named graphs)
>
> Should I have a close look at the SPARQL standard or is there a bug ?
>
> Regards,
>
> Michael Brunnbauer
>
> On Wed, Jul 17, 2013 at 07:10:14PM +0100, Andy Seaborne wrote:
> > On 17/07/13 13:10, Michael Brunnbauer wrote:
> > >
> > >hi all,
> > >
> > >this query with Fuseki 0.2.7 on a TDB with named graphs yields 2 for ?c:
> > >
> > >PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> > >select (count(*) as ?c) where { graph ?g {
> > > SERVICE <http://127.0.0.1:3030/datasets/query> {
> > > ?d rdfs:subClassOf <example>
> > > }
> > > ?s ?p ?d
> > >} }
> > >
> > >But as soon as I wrap it as subquery, ?c is 9436 - the number of all
> > >triples
> > >from all named graphs:
> > >
> > >PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> > >select ?c where {
> > >
> > >select (count(*) as ?c) where { graph ?g {
> > > SERVICE <http://127.0.0.1:3030/datasets/query> {
> > > ?d rdfs:subClassOf <example>
> > > }
> > > ?s ?p ?d
> > >} }
> > >
> > >}
> > >
> > >(The federated subquery on http://127.0.0.1:3030/datasets/query has one
> > >subclass as result)
> > >
> > >Is this a bug or a misunderstanding ?
> >
> > It's not a bug as far as I can see.
> >
> > To debug, try "SELECT * ... LIMIT 100"
> >
> > COUNT(*) is the number of rows in the answers. In your first query,
> > there must be either two ?g and the { ?d rdfs:subClassOf <example> }
> > matches once, or one ?g and { ?d rdfs:subClassOf <example> } matches twice.
> >
> > In the second query, that is joined with "?s ?p ?d" in the named graph
> > of the local machine which has 4718 triples with the same ?d.
> >
> > select (count(distinct ?g) as ?c)
> >
> > would count the named graphs only (inefficiently!)
> >
> > Andy
> >
> > >
> > >Regards,
> > >
> > >Michael Brunnbauer
> > >
>
> --
> ++ Michael Brunnbauer
> ++ netEstate GmbH
> ++ Geisenhausener Straße 11a
> ++ 81379 München
> ++ Tel +49 89 32 19 77 80
> ++ Fax +49 89 32 19 77 89
> ++ E-Mail [email protected]
> ++ http://www.netestate.de/
> ++
> ++ Sitz: München, HRB Nr.142452 (Handelsregister B München)
> ++ USt-IdNr. DE221033342
> ++ Geschäftsführer: Michael Brunnbauer, Franz Brunnbauer
> ++ Prokurist: Dipl. Kfm. (Univ.) Markus Hendel
--
++ Michael Brunnbauer
++ netEstate GmbH
++ Geisenhausener Straße 11a
++ 81379 München
++ Tel +49 89 32 19 77 80
++ Fax +49 89 32 19 77 89
++ E-Mail [email protected]
++ http://www.netestate.de/
++
++ Sitz: München, HRB Nr.142452 (Handelsregister B München)
++ USt-IdNr. DE221033342
++ Geschäftsführer: Michael Brunnbauer, Franz Brunnbauer
++ Prokurist: Dipl. Kfm. (Univ.) Markus Hendel
pgpO3_nehI4uU.pgp
Description: PGP signature
