SELECT ?item CONCAT(?item ," ", ?label) AS ?label REPLACE(STR(?tr2), transformation:, "") AS ?id_x SUM(?num) AS ?count FROM <http://reactionontology.org> WHERE { { SELECT DISTINCT ?q ?tr2 COUNT(?tr2) AS ?num WHERE { { SELECT DISTINCT ?q ?ec ?tr2 WHERE { VALUES ?q { #{QUERY} } BIND(?q as ?q2) ?q piero:hasChild* ?ec . ?ec piero:hasIubmb ?iubmb . ?iubmb owl:equivalentTo ?tr . ?tr2 a piero:transformation . ?tr2 piero:hasParent transformation:#{TR} . ?tr piero:hasParent* ?tr2 . } } } }UNION{ SELECT DISTINCT ?q ?tr2 ?num WHERE { VALUES ?q { #{QUERY} } BIND(?q as ?q2) ?tr2 a piero:transformation . ?tr2 piero:hasParent transformation:#{TR} . BIND(0 AS ?num) } } ?tr2 rdfs:label ?label FILTER(! REGEX(STR(?label), "sation")) BIND(REPLACE(STR(?q), ec:, "ec:") AS ?item) } ORDER BY ?tr2 ?item
ec:
tr:
rw:
Query