0

How do I store null values in a triplestore database?

Should I use no triples for null values or use something like rdf:nil ? If I use no triples, how do I query then for non existing triples?

Artisan72
  • 3,052
  • 3
  • 23
  • 30
  • Does the related [Modelling an equivalent of database NULL in RDF](http://stackoverflow.com/q/16873174/1281433) question help here? There are several answers, and I think that question is a bit more comprehensive. – Joshua Taylor Aug 26 '15 at 12:43

1 Answers1

2

You can use the FILTER NOT EXISTS syntax to check for non-existence

For example assuming you know the subject and predicate and want to check for a null value i.e. non-existence of the relevant triple you could do the following:

ASK WHERE
{
   FILTER NOT EXISTS { <http://subject> <http://predicate> ?value }
}
RobV
  • 28,022
  • 11
  • 77
  • 119