callbacks.pyx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. from lakesuperior.model.base cimport Key, TripleKey
  2. cdef bint lookup_sk_cmp_fn(
  3. const TripleKey* spok, const Key* k1, const Key* k2
  4. ):
  5. """ Keyset lookup for S key. """
  6. return spok[0] == k1
  7. cdef bint lookup_pk_cmp_fn(
  8. const TripleKey* spok, const Key* k1, const Key* k2
  9. ):
  10. """ Keyset lookup for P key. """
  11. return spok[1] == k1
  12. cdef bint lookup_ok_cmp_fn(
  13. const TripleKey* spok, const Key* k1, const Key* k2
  14. ):
  15. """ Keyset lookup for O key. """
  16. return spok[2] == k1
  17. cdef bint lookup_skpk_cmp_fn(
  18. const TripleKey* spok, const Key* k1, const Key* k2
  19. ):
  20. """ Keyset lookup for S and P keys. """
  21. return spok[0] == k1 and spok[1] == k2
  22. cdef bint lookup_skok_cmp_fn(
  23. const TripleKey* spok, const Key* k1, const Key* k2
  24. ):
  25. """ Keyset lookup for S and O keys. """
  26. return spok[0] == k1 and spok[2] == k2
  27. cdef bint lookup_pkok_cmp_fn(
  28. const TripleKey* spok, const Key* k1, const Key* k2
  29. ):
  30. """ Keyset lookup for P and O keys. """
  31. return spok[1] == k1 and spok[2] == k2