In order to build a more user-friendly, intelligent IoT where interactions between Human-to-Human, Object-to-Object, and Human-to-Object coexists, real-world objects are assigned a social network identity on current SNS. Under this scenario, the contexts of the real-world objects become more complicated since it contains both social attributes and physical attributes. This paper proposed a context-aware middleware for infers the contexts of real-world objects in SNS. The deduced context of the object is generated from the physical contexts, which retrieved from WoT infrastructure and social network context from SNS, which results in the quality of the context more dependent to the real state of the object. Then, services or behavior will be triggered by the middleware after the reasoning process. Implementation on the MagicHome project will illustrate the feasibility and reasonability of middleware in a smart home scenario.