417 for const in vconsts: |
417 for const in vconsts: |
418 if ms_scope(const) in source_scopes: |
418 if ms_scope(const) in source_scopes: |
419 self._set_source_for_term(source, const) |
419 self._set_source_for_term(source, const) |
420 # if system source is used, add every rewritten constant |
420 # if system source is used, add every rewritten constant |
421 # to its supported terms even when associated entity |
421 # to its supported terms even when associated entity |
422 # doesn't actually come from it so we get a changes |
422 # doesn't actually come from it so we get a changes that |
423 # that allequals will return True as expected when |
423 # allequals will return True as expected when computing |
424 # computing needsplit |
424 # needsplit |
425 # check const is used in a relation restriction |
425 # check const is used in a relation restriction |
426 if const.relation() and self.system_source in sourcesterms: |
426 if const.relation() and self.system_source in sourcesterms: |
427 self._set_source_for_term(self.system_source, const) |
427 self._set_source_for_term(self.system_source, const) |
428 # add source for relations |
428 # add source for relations |
429 rschema = self._schema.rschema |
429 rschema = self._schema.rschema |
430 termssources = {} |
430 termssources = {} |
431 for rel in self.rqlst.iget_nodes(Relation): |
431 for rel in self.rqlst.iget_nodes(Relation): |
432 # process non final relations only |
432 # process non final relations only |
433 # note: don't try to get schema for 'is' relation (not available |
433 # note: don't try to get schema for 'is' relation (not available |
434 # during bootstrap) |
434 # during bootstrap) |
435 if not rel.is_types_restriction() and not rschema(rel.r_type).final: |
435 if not (rel.is_types_restriction() or rschema(rel.r_type).final): |
436 # nothing to do if relation is not supported by multiple sources |
436 # nothing to do if relation is not supported by multiple sources |
437 # or if some source has it listed in its cross_relations |
437 # or if some source has it listed in its cross_relations |
438 # attribute |
438 # attribute |
439 # |
439 # |
440 # XXX code below don't deal if some source allow relation |
440 # XXX code below don't deal if some source allow relation |
1427 |
1427 |
1428 def visit_relation(self, node, newroot, terms): |
1428 def visit_relation(self, node, newroot, terms): |
1429 if not node.is_types_restriction(): |
1429 if not node.is_types_restriction(): |
1430 if node in self.skip and self.solindices.issubset(self.skip[node]): |
1430 if node in self.skip and self.solindices.issubset(self.skip[node]): |
1431 if not self.schema.rschema(node.r_type).final: |
1431 if not self.schema.rschema(node.r_type).final: |
1432 # can't really skip the relation if one variable is selected and only |
1432 # can't really skip the relation if one variable is selected |
1433 # referenced by this relation |
1433 # and only referenced by this relation |
1434 for vref in node.iget_nodes(VariableRef): |
1434 for vref in node.iget_nodes(VariableRef): |
1435 stinfo = vref.variable.stinfo |
1435 stinfo = vref.variable.stinfo |
1436 if stinfo['selected'] and len(stinfo['relations']) == 1: |
1436 if stinfo['selected'] and len(stinfo['relations']) == 1: |
1437 break |
1437 break |
1438 else: |
1438 else: |