File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -514,9 +514,19 @@ def exists(self, client: KGClient) -> bool:
514
514
client = client ,
515
515
filters = query_filter ,
516
516
)
517
- instances = client .query (query = query , size = 1 , scope = "any" ).data
517
+ instances = client .query (query = query , size = 2 , scope = "any" ).data
518
518
519
519
if instances :
520
+ if len (instances ) > 1 :
521
+ raise Exception ("Existence query is not specific enough" )
522
+
523
+ # it seems that sometimes the "query" endpoint returns instances
524
+ # which the "instances" endpoint doesn't know about, so here we double check that
525
+ # the instance can be found
526
+ instance = client .instance_from_full_uri (instances [0 ]["@id" ], scope = "any" )
527
+ if instance is None :
528
+ return False
529
+
520
530
self .id = instances [0 ]["@id" ]
521
531
assert isinstance (self .id , str )
522
532
save_cache [self .__class__ ][query_cache_key ] = self .id
You can’t perform that action at this time.
0 commit comments