Resource subj = (Resource)getConstantValue(sp.getSubjectVar());
URI pred = (URI)getConstantValue(sp.getPredicateVar());
Value obj = getConstantValue(sp.getObjectVar());
Resource context = (Resource)getConstantValue(sp.getContextVar());
MemValueFactory valueFactory = store.getValueFactory();
// Perform look-ups for value-equivalents of the specified values
MemResource memSubj = valueFactory.getMemResource(subj);
MemURI memPred = valueFactory.getMemURI(pred);
MemValue memObj = valueFactory.getMemValue(obj);
MemResource memContext = valueFactory.getMemResource(context);
if (subj != null && memSubj == null || pred != null && memPred == null || obj != null
&& memObj == null || context != null && memContext == null)
{
// non-existent subject, predicate, object or context