rdf_storage_sqlite_mro.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // rdf_storage_sqlite_mro.h
  3. //
  4. // Created by Marcus Rohrmoser on 19.05.14.
  5. //
  6. // Copyright (c) 2014-2015, Marcus Rohrmoser mobile Software, http://mro.name/me
  7. // All rights reserved.
  8. //
  9. // Redistribution and use in source and binary forms, with or without modification, are permitted
  10. // provided that the following conditions are met:
  11. //
  12. // 1. Redistributions of source code must retain the above copyright notice, this list of conditions
  13. // and the following disclaimer.
  14. //
  15. // 2. The software must not be used for military or intelligence or related purposes nor
  16. // anything that's in conflict with human rights as declared in http://www.un.org/en/documents/udhr/ .
  17. //
  18. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  19. // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  20. // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  21. // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  24. // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  25. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. //
  27. #ifndef Redland_rdf_storage_sqlite_mro_h
  28. #define Redland_rdf_storage_sqlite_mro_h
  29. #ifndef LIBRDF_STORAGE_SQLITE_MRO_CONVENIENCE
  30. #define LIBRDF_STORAGE_SQLITE_MRO_CONVENIENCE 0
  31. #endif
  32. #if LIBRDF_STORAGE_SQLITE_MRO_CONVENIENCE
  33. #include <stdbool.h>
  34. #endif
  35. #include <librdf.h>
  36. /** Storage Factory name. */
  37. extern const char *LIBRDF_STORAGE_SQLITE_MRO;
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /** Register factory.
  42. *
  43. * # Typical Usage
  44. *
  45. * #include "rdf_storage_sqlite_mro.h"
  46. * ....
  47. * librdf_world *world = librdf_new_world();
  48. * librdf_init_storage_sqlite_mro(world); // register storage factory
  49. * ....
  50. * const char* options = "new='yes', contexts='no'";
  51. * librdf_storage *newStorage = librdf_new_storage(world, LIBRDF_STORAGE_SQLITE_MRO, file_path, options);
  52. */
  53. int librdf_init_storage_sqlite_mro(librdf_world *);
  54. #if LIBRDF_STORAGE_SQLITE_MRO_CONVENIENCE
  55. /** Typed convenience wrapper for librdf_storage_set_feature(storage,uri,literal) */
  56. int librdf_storage_set_feature_mro_bool(librdf_storage *, const unsigned char *feature, bool value);
  57. /** Typed convenience wrapper for librdf_storage_set_feature(storage,uri,literal) */
  58. int librdf_storage_set_feature_mro_int(librdf_storage *, const unsigned char *feature, int value);
  59. /** Typed convenience wrapper for librdf_storage_get_feature(storage,uri) */
  60. int librdf_storage_get_feature_mro_bool(librdf_storage *, const unsigned char *feature, bool *value);
  61. /** Typed convenience wrapper for librdf_storage_get_feature(storage,uri) */
  62. int librdf_storage_get_feature_mro_int(librdf_storage *, const unsigned char *feature, int *value);
  63. #endif
  64. #ifdef __cplusplus
  65. } // extern "C"
  66. #endif
  67. /** Which triple-find-queries should be cached. Bitmask, http://www.w3.org/2000/10/XMLSchema#unsignedShort.
  68. * Clipped to 0x1FF.
  69. */
  70. extern const unsigned char *LIBRDF_STORAGE_SQLITE_MRO_FEATURE_SQL_CACHE_MASK;
  71. /** Register sqlite3_profile or not. http://www.w3.org/2000/10/XMLSchema#boolean. */
  72. extern const unsigned char *LIBRDF_STORAGE_SQLITE_MRO_FEATURE_SQLITE3_PROFILE;
  73. /** Print (some) sqlite3 'EXPLAIN QUERY PLAN' or not. http://www.w3.org/2000/10/XMLSchema#boolean. */
  74. extern const unsigned char *LIBRDF_STORAGE_SQLITE_MRO_FEATURE_SQLITE3_EXPLAIN_QUERY_PLAN;
  75. #endif