def save(self):
     """Save and serialize the iterator as a machine-readable format"""
     saved_filter = SavedFilterIterator()
     source_field = self._source.serialized_name() + '_source'
     getattr(saved_filter, source_field).CopyFrom(self._source.save())
     saved_filter.expression = self._raw_expression
     if self._mu is not None:
         pyDict_to_protoDict(self._mu, saved_filter.mu)
     return saved_filter
Beispiel #2
0
 def save(self) -> SavedBindIterator:
     """Save and serialize the iterator as a Protobuf message"""
     saved_bind = SavedBindIterator()
     if self._source is not None:
         source_field = self._source.serialized_name() + '_source'
         getattr(saved_bind, source_field).CopyFrom(self._source.save())
     saved_bind.bindexpr = self._expr
     saved_bind.bindvar = self._bindvar
     if self._mu is not None:
         pyDict_to_protoDict(self._mu, saved_bind.mu)
     return saved_bind
Beispiel #3
0
 def save(self) -> SavedIndexJoinIterator:
     """Save and serialize the iterator as a Protobuf message"""
     saved_join = SavedIndexJoinIterator()
     # export left source
     left_field = self._left.serialized_name() + '_left'
     getattr(saved_join, left_field).CopyFrom(self._left.save())
     # export right source
     right_field = self._right.serialized_name() + '_right'
     getattr(saved_join, right_field).CopyFrom(self._right.save())
     if self._current_mappings is not None:
         pyDict_to_protoDict(self._current_mappings, saved_join.muc)
     return saved_join
Beispiel #4
0
 def save(self) -> SavedScanIterator:
     """Save and serialize the iterator as a Protobuf message"""
     saved_scan = SavedScanIterator()
     triple = TriplePattern()
     triple.subject = self._pattern['subject']
     triple.predicate = self._pattern['predicate']
     triple.object = self._pattern['object']
     triple.graph = self._pattern['graph']
     saved_scan.pattern.CopyFrom(triple)
     saved_scan.cardinality = self._cardinality
     if self._current_mappings is not None:
         pyDict_to_protoDict(self._current_mappings, saved_scan.muc)
     saved_scan.last_read = self._source.last_read()
     if self._start_timestamp is not None:
         saved_scan.timestamp = self._start_timestamp.isoformat()
     if self._mu is not None:
         pyDict_to_protoDict(self._mu, saved_scan.mu)
     return saved_scan
 def save(self):
     """Save the operator using protobuf"""
     saved_join = SavedIndexJoinIterator()
     # save source operator
     source_field = self._source.serialized_name() + '_source'
     getattr(saved_join, source_field).CopyFrom(self._source.save())
     # save inner join
     inner = TriplePattern()
     inner.subject = self._innerTriple['subject']
     inner.predicate = self._innerTriple['predicate']
     inner.object = self._innerTriple['object']
     inner.graph = self._innerTriple['graph']
     saved_join.inner.CopyFrom(inner)
     if self._currentBinding is not None:
         pyDict_to_protoDict(self._currentBinding, saved_join.muc)
     if self._currentIter is not None:
         saved_join.last_read = self._currentIter.last_read()
     return saved_join
Beispiel #6
0
 def save(self) -> SavedInsertData:
     """Save and serialize the iterator as a Protobuf message"""
     saved = SavedInsertData()
     pyDict_to_protoDict(self._inserted, saved.nb_inserted)
     return saved