find_triples.sql 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. --
  2. -- Copyright (c) 2014-2015, Marcus Rohrmoser mobile Software, http://mro.name/me
  3. -- All rights reserved.
  4. --
  5. -- Redistribution and use in source and binary forms, with or without modification, are permitted
  6. -- provided that the following conditions are met:
  7. --
  8. -- 1. Redistributions of source code must retain the above copyright notice, this list of conditions
  9. -- and the following disclaimer.
  10. --
  11. -- 2. The software must not be used for military or intelligence or related purposes nor
  12. -- anything that's in conflict with human rights as declared in http://www.un.org/en/documents/udhr/ .
  13. --
  14. -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  15. -- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  16. -- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  17. -- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  18. -- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  19. -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  20. -- IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  21. -- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. --
  23. -- result columns must match as in enum idx_triple_column_t
  24. SELECT
  25. -- all *_id (hashes):
  26. id
  27. ,s_uri_id
  28. ,s_blank_id
  29. ,p_uri_id
  30. ,o_uri_id
  31. ,o_blank_id
  32. ,o_lit_id
  33. ,o_datatype_id
  34. ,c_uri_id
  35. -- all values:
  36. ,s_uri
  37. ,s_blank
  38. ,p_uri
  39. ,o_uri
  40. ,o_blank
  41. ,o_text
  42. ,o_language
  43. ,o_datatype
  44. ,c_uri
  45. FROM triples
  46. WHERE 1
  47. -- subject
  48. AND s_uri_id = :s_uri_id
  49. AND s_blank_id = :s_blank_id
  50. -- predicate
  51. AND p_uri_id = :p_uri_id
  52. -- object
  53. AND o_uri_id = :o_uri_id
  54. AND o_blank_id = :o_blank_id
  55. AND o_lit_id = :o_lit_id
  56. -- context node
  57. AND c_uri_id = :c_uri_id