## 1 Introduction  
A hundred years from their initial development, deployment and spreading, power networks must face nowadays a new revolution. With the impending peak of petrol production, the continuous increase in the demand worldwide as well as the need to reduce greenhouse gases, efficiency at all levels becomes the key to the optimal and sustainable use of the resources. Yet energy efficiency is not the only goal to be achieved: a number of new models, methods and possibilities are already imposing different requirements that the classical power networks just cannot fulfil. The paradigm _smart grid_ (term coined in contrast to the _old_ allegedly non-intelligent ones) refers to the future electrical networks in which these upcoming scenarios and ICT will go hand in hand to achieve this excellence. Historically, the electrical grid evolved to nation-wide scale controlled centrally by the government. The liberalization of electric markets broke this tight shape, opening the way to transnational energy business and corporations. However, the inheritance of the legacy infrastructure remained: diverse network specifications, models, protocols, _de facto_ standards, architecture and markets...preventing, hence, the design and development of an unique smart grid approach [1]. As the supply is constantly struggling to meet the demand, there has been a notable research effort around smart grid as the keystone to the efficient energy management and consumption. The focus has been laid on certain aspects of the problem, usually either the logical _or_ the physical part, such as demand response [2], voltage balancing [3], distributed management [4; 5; 6], integration of renewables [7; 8], failure recovery [9], or diverse communication issues [10; 11; 12; 13]. We present here the ENERGOS project [14], which fully addresses the optimal deployment and management of smart grids in both levels, _i.e._, logical and physical. Though ENERGOS is not the first effort to employ the so-called _Semantic Web Technologies_, it is the primer to use them thoroughly in its architecture, fully exploiting the advantage that this model offers. Since the smart grid concept involves a radical role change of the system-wide participants (e.g., passive members such as clients will generate _and_ simultaneously consume information becoming in this way _prosumers_), there is a pressing issue concerning handling, storing, and extracting knowledge (_i.e._, taking advantage) of the data created, all in real-time and flowing bidirectionally: consumption measures of millions of clients, price signals, grid events, transport network operation orders, alarms, and so on, including data of integrated brand-new technologies such as the electric vehicle (EV). The semantic web was designed to dam, cope and finally exploit such data floods, but it is not yet mature enough and a number of open issues remain to be addressed. For instance, assuming that the majority of the data generators in the system were semantic nodes (_i.e._, _information_ generators), it is not yet clear which existing technologies may allow the best way to store and query that information (which may require real-time handling). There exist some initiatives [15] dealing with managing big amounts of semantic data (streams), but this framework has not been tested so far under the special premises of the electric domain and neither has it been combined with other middle-ware communication solutions as we do here. Moreover, having distributed information stores implies that a query must be divided, sent to the nodes that may have the pertinent information, and rejoined when the results arrive (_i.e._, the so-called _query federation_ problem [16]). In summary, there are a number of issues unaddressed concerning intelligence distribution and semantic information processing in the smart grid domain. Against this background, we present here an advance in the state-of-the-art in two aspects.