HLR / DomiKnowS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fetching the values of the relations inside the sensors

hfaghihi15 opened this issue · comments

Hi @guoquan,
I see that you have updated the fetch value function for the functional sensor to the following code.

    def fetch_value(self, pre, selector=None, concept=None):
        from ...graph.relation import Transformed
        concept = concept or self.concept
        if isinstance(pre, str):
            return super().fetch_value(pre, selector, concept)
        elif isinstance(pre, (Property, Sensor)):
            return self.context_helper[pre]
        elif isinstance(pre, Transformed):
            return pre(self.context_helper, device=self.device)
        return pre

It seems that this doesn't have anything specialized for relation and I am not sure if the relation name is just considered to be a property instance here, but when I fetch value with the variable representing the relation it just returns the relation object back. Should we add another specific "if" to handle the relations as properties or am I missing something here?

That's right. There should be a specification for understanding Relation as property. I should already have this specification somewhere but I am not sure. I can check and make sure develop_datanode has this. Get Outlook for iOShttps://aka.ms/o0ukef

________________________________ From: hfaghihi15 notifications@github.com Sent: Thursday, January 14, 2021 10:17:02 AM To: HLR/DomiKnowS DomiKnowS@noreply.github.com Cc: Guo, Quan guoquanscu@gmail.com; Assign assign@noreply.github.com Subject: Re: [HLR/DomiKnowS] Fetching the values of the relations inside the sensors (#243) Assigned #243<#243> to @guoquanhttps://github.com/guoquan. — You are receiving this because you were assigned. Reply to this email directly, view it on GitHub<#243 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAIRAPTJRIPSREYBY4SNQH3SZZHZ5ANCNFSM4WBXJPSA.

Thanks.
I guess just adding the following line should resolve the issue, so if you didn't have the setting just add this to the flow:

elif isinstance(pre, Relation):
        return self.context_helper[self.concept[pre]]