1

I created a CONSTRUCT query in ARC2 PHP, but how is it possible to count how many triplets I have received?

$query = '
  PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
  PREFIX owl: <http://www.w3.org/2002/07/owl#>
  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
   PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
   PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

   CONSTRUCT { ?c rdfs:label ?name }
 WHERE {
   ?c rdf:type dbpedia-owl:City. 
   ?c rdfs:label ?name .
   ?c dbpedia-owl:country <http://dbpedia.org/resource/Italy> .
   OPTIONAL { ?c dbpedia-owl:areaCode ?areacode }
   FILTER ( lang(?name) = "it")
 }';

Because right now the query doesn't write any output.

Phonolog
  • 6,321
  • 3
  • 36
  • 64
elka
  • 25
  • 3
  • Does it work in the DBpedia web interface? And don't forget that you have to query the correct dataset as I told you last time, i.e. either connect to the SPARQL endpoint or make sure that you load data that matches the query. – UninformedUser Feb 17 '17 at 13:08
  • Ok, I checked in on DBpedia and it returns some data. – UninformedUser Feb 17 '17 at 13:10
  • OK, thank you @AKSW! I connect to DBPedia endpoint. Will try again. I think that my problem is that I do not output it correctly. – elka Feb 22 '17 at 08:58

1 Answers1

2
SELECT (COUNT(*) as ?cnt) WHERE { ?s ?p ?o }
UninformedUser
  • 8,397
  • 1
  • 14
  • 23