@@ -108,18 +108,18 @@ def search(self, query, schema=None, schemata=None, filters=None):
108
108
filters .append (('schemata' , schemata ))
109
109
if schema is None and schemata is None :
110
110
filters .append (('schemata' , 'Thing' ))
111
- url = self ._make_url (" entities" , query = query , filters = filters )
111
+ url = self ._make_url (' entities' , query = query , filters = filters )
112
112
return APIResultSet (self , url )
113
113
114
114
def get_collection (self , collection_id ):
115
115
"""Get a single collection by ID (not foreign ID!)."""
116
- url = self ._make_url (" collections/{0}" .format (collection_id ))
117
- return self ._request (" GET" , url )
116
+ url = self ._make_url (' collections/{0}' .format (collection_id ))
117
+ return self ._request (' GET' , url )
118
118
119
119
def get_entity (self , entity_id ):
120
120
"""Get a single entity by ID."""
121
- url = self ._make_url (" entities/{0}" .format (entity_id ))
122
- return self ._request (" GET" , url )
121
+ url = self ._make_url (' entities/{0}' .format (entity_id ))
122
+ return self ._request (' GET' , url )
123
123
124
124
def get_collection_by_foreign_id (self , foreign_id ):
125
125
"""Get a dict representing a collection based on its foreign ID."""
@@ -194,8 +194,7 @@ def map_collection(self, collection_id, mapping):
194
194
url = self ._make_url ("collections/{0}/mapping" .format (collection_id ))
195
195
return self ._request ("PUT" , url , json = mapping )
196
196
197
- def stream_entities (self , collection_id = None , include = None ,
198
- schema = None , decode_json = True ):
197
+ def stream_entities (self , collection_id = None , include = None , schema = None ):
199
198
"""Iterate over all entities in the given collection.
200
199
201
200
params
@@ -275,6 +274,12 @@ def match(self, entity, collection_ids=None, url=None):
275
274
except RequestException as exc :
276
275
raise AlephException (exc )
277
276
277
+ def linkages (self , context_ids = None ):
278
+ """Stream all linkages within the given role contexts."""
279
+ filters = [('context_id' , c ) for c in ensure_list (context_ids )]
280
+ url = self ._make_url ('linkages' , filters = filters )
281
+ return APIResultSet (self , url )
282
+
278
283
def ingest_upload (self , collection_id , file_path = None , metadata = None ):
279
284
"""
280
285
Create an empty folder in a collection or upload a document to it
0 commit comments