@prefix ex: <https://sparql.uniprot.org/.well-known/sparql-examples/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

ex:17 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Select the average number of cross-references to the <a href=\"${uniprot}database/DB-0070\">PDB</a> database of UniProtKB entries that have at least one cross-reference to the PDB database"^^rdf:HTML ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT (AVG(?linksToPdbPerEntry) AS ?avgLinksToPdbPerEntry)
WHERE
{
	SELECT ?protein (COUNT(DISTINCT ?db) AS ?linksToPdbPerEntry)
	WHERE
	{
		?protein a up:Protein .
		?protein rdfs:seeAlso ?db .
		?db up:database <http://purl.uniprot.org/database/PDB> .
	}
	GROUP BY ?protein ORDER BY DESC(?linksToPdbPerEntry)
}""" ;
    schema:keywords "cross-reference" , "count" , "PDB" ;
    schema:target <https://sparql.uniprot.org/sparql/> .

