Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleCount information resources without labels
SELECT (COUNT(DISTINCT ?s) AS ?count)
WHERE {
    ?s rdf:type vivo:InformationResource .
    OPTIONAL {?s rdfs:label ?label .}
    FILTER(!bound(?label))
}

Using a nested query to get multiple counts

The above queries can be combined in a single query which returns multiple counts.

Code Block
titleUsing a nested query to get multiple counts
SELECT ?count_agents ?count_information_resources
WHERE {
    {
    SELECT (COUNT(DISTINCT ?s) AS ?count_agents)
    WHERE {
        ?s rdf:type foaf:Agent .
        OPTIONAL {?s rdfs:label ?label .}
        FILTER(!bound(?label))
    }
    }


    {
    SELECT (COUNT(DISTINCT ?s) AS ?count_information_resources)
    WHERE {
        ?s rdf:type vivo:InformationResource .
        OPTIONAL {?s rdfs:label ?label .}
        FILTER(!bound(?label))
    }
    }
}