semsol / arc2

ARC RDF Classes for PHP
Other
332 stars 89 forks source link

ARC2_Store::query: function COUNT fails #101

Closed k00ni closed 6 years ago

k00ni commented 6 years ago

I don't expect this issue to be solved soon, but i want to document it because i need it for a pull request.

Given the following RDF:

@prefix : <http://www.example.org/> .

:s :p1 :o1, :o2, :o3.
:s :p2 :o1, :o2.

The following query:

PREFIX : <http://www.example.org>

SELECT (COUNT(?O) AS ?C)
WHERE { ?S ?P ?O }

should return:

array {
  'variables' => array { "C" }
  'rows' => array {
    array {
      'C' => "5"
      'C type' => 'literal"
    }
  }
}

but returns

array {
  'variables' => array { "C" }
  'rows' => array {
    array {
      'C' => "318" // <=============== problem
      'C type' => 'literal"
    }
  }
}
k00ni commented 6 years ago

Sorry, false alarm. Query needed FROM clause.