diff options
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/cpp/include/serd/serd.hpp | 2 | ||||
-rw-r--r-- | bindings/cpp/meson.build | 17 | ||||
-rw-r--r-- | bindings/python/serd.pyx | 20 |
3 files changed, 26 insertions, 13 deletions
diff --git a/bindings/cpp/include/serd/serd.hpp b/bindings/cpp/include/serd/serd.hpp index 95abcc04..80d588c8 100644 --- a/bindings/cpp/include/serd/serd.hpp +++ b/bindings/cpp/include/serd/serd.hpp @@ -1626,7 +1626,7 @@ public: return serd_model_count(cobj(), s.cobj(), p.cobj(), o.cobj(), g.cobj()); } - Range all() const { return Range(serd_model_all(cobj())); } + Range all() const { return Range(serd_model_all(cobj(), SERD_ORDER_SPO)); } iterator begin() const { diff --git a/bindings/cpp/meson.build b/bindings/cpp/meson.build index 627e537c..b9b2869c 100644 --- a/bindings/cpp/meson.build +++ b/bindings/cpp/meson.build @@ -1,19 +1,17 @@ versioned_cpp_name = 'serdxx' + version_suffix -cpp_prog_args = [] - # Set ultra strict warnings for developers, if requested +cpp_suppressions = [] if get_option('strict') - cpp_warnings = all_cpp_warnings if cpp.get_id() == 'clang' - cpp_warnings += [ + cpp_suppressions += [ '-Wno-documentation-unknown-command', '-Wno-format-nonliteral', '-Wno-nullability-extension', '-Wno-padded', ] elif cpp.get_id() == 'gcc' - cpp_warnings += [ + cpp_suppressions += [ '-Wno-abi-tag', '-Wno-float-equal', '-Wno-inline', @@ -24,7 +22,7 @@ if get_option('strict') '-Wno-unused-const-variable', ] elif cpp.get_id() == 'msvc' - cpp_warnings += [ + cpp_suppressions += [ '/wd4355', # 'this' used in base member initializer list '/wd4571', # structured exceptions are no longer caught '/wd4623', # default constructor implicitly deleted @@ -36,11 +34,10 @@ if get_option('strict') '/wd5027', # move assignment operator implicitly deleted ] endif - - cpp_prog_args = cpp.get_supported_arguments(cpp_warnings) - endif +exess_cpp_args = cpp.get_supported_arguments(cpp_suppressions) + cpp_headers = [ 'include/serd/serd.hpp', 'include/serd/detail/Copyable.hpp', @@ -70,6 +67,6 @@ test('bindings', executable('test_serd_hpp', 'test/test_serd_hpp.cpp', include_directories: include_directories(['include']), - cpp_args: cpp_prog_args + cpp_test_args, + cpp_args: exess_cpp_args + cpp_test_args, dependencies: [serd_dep, serdxx_dep]), suite: 'cpp') diff --git a/bindings/python/serd.pyx b/bindings/python/serd.pyx index e2ed0c6c..0ec102c2 100644 --- a/bindings/python/serd.pyx +++ b/bindings/python/serd.pyx @@ -40,6 +40,7 @@ cdef extern from "serd/serd.h": ctypedef enum SerdNodeType: pass ctypedef enum SerdNodeFlag: pass ctypedef enum SerdField: pass + ctypedef enum SerdStatementOrder: pass ctypedef enum SerdModelFlag: pass ctypedef uint32_t SerdStatementFlags @@ -461,7 +462,8 @@ cdef extern from "serd/serd.h": bint serd_model_empty(const SerdModel* model); SerdIter* serd_model_begin(const SerdModel* model); const SerdIter* serd_model_end(const SerdModel* model); - SerdRange* serd_model_all(const SerdModel* model); + SerdRange* serd_model_all(const SerdModel* model, + const SerdStatementOrder order); SerdIter* serd_model_find(const SerdModel* model, const SerdNode* s, @@ -607,6 +609,20 @@ class Field(enum.IntEnum): OBJECT = 2 # Object ("value") GRAPH = 3 # Graph ("context") +class StatementOrder(enum.IntEnum): + """Statement ordering.""" + SPO = 0 # Subject, Predicate, Object + SOP = 1 # Subject, Object, Predicate + OPS = 2 # Object, Predicate, Subject + OSP = 3 # Object, Subject, Predicate + PSO = 4 # Predicate, Subject, Object + POS = 5 # Predicate, Object, Subject + GSPO = 6 # Graph, Subject, Predicate, Object + GSOP = 7 # Graph, Subject, Object, Predicate + GOPS = 8 # Graph, Object, Predicate, Subject + GOSP = 9 # Graph, Object, Subject, Predicate + GPSO = 10 # Graph, Predicate, Subject, Object + GPOS = 11 # Graph, Predicate, Object, Subject class ModelFlags(enum.IntFlag): """Flags that control model storage and indexing.""" @@ -1662,7 +1678,7 @@ cdef class Model: def all(self) -> Range: """Return a range that contains all statements in the model.""" - return Range._manage(serd_model_all(self._ptr)) + return Range._manage(serd_model_all(self._ptr, StatementOrder.SPO)) def _find(self, statement) -> _Iter: statement = Statement._from_param(statement) |