diff options
author | David Robillard <d@drobilla.net> | 2021-03-08 23:25:35 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-09 01:43:52 -0500 |
commit | 7b954f5667e82de1b64984a9aeb26b8ebb5cab81 (patch) | |
tree | 5668f80ce2dc7a52cf66bbe2f4e4429b18f09e08 /bindings/python | |
parent | c579186c5dd4e11bffddd353cef8978a66ef9c10 (diff) | |
download | serd1-meson.tar.gz serd1-meson.tar.bz2 serd1-meson.zip |
WIP: Validationserd1-meson
Diffstat (limited to 'bindings/python')
-rw-r--r-- | bindings/python/serd.pyx | 20 |
1 files changed, 18 insertions, 2 deletions
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) |