Skip to content

Instantly share code, notes, and snippets.

@shellac
Created November 2, 2011 19:49
Show Gist options
  • Save shellac/1334684 to your computer and use it in GitHub Desktop.
Save shellac/1334684 to your computer and use it in GitHub Desktop.
Validate complete absence of bios
# Explanation:
# ASK returns 'true' if there are any results
# The inner query says:
# Get agents and (if there) bio:event
# Count agents and bios, and check if there are agents present, but no bios
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX bio: <http://purl.org/vocab/bio/0.1/>
ASK {
SELECT (count(?x) as ?agents) (count(?y) as ?bios)
{
?x a foaf:Agent
OPTIONAL { ?x bio:event ?y }
} HAVING (?agents > 0 && ?bios = 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment