EMlab-generation Documentation  1.0
Documentation of the EMLab-Generation model.
MarketRepository.java
1 /*******************************************************************************
2  * Copyright 2012 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 package emlab.gen.repository;
17 
18 import java.util.List;
19 
20 import org.springframework.data.neo4j.annotation.Query;
21 import org.springframework.data.neo4j.annotation.QueryType;
22 import org.springframework.data.neo4j.repository.GraphRepository;
23 import org.springframework.data.repository.query.Param;
24 import org.springframework.stereotype.Repository;
25 
35 
43 @Repository
44 public interface MarketRepository extends GraphRepository<DecarbonizationMarket> {
45 
51  @Query(value = "start market=node:__types__(\"className:emlab.gen.domain.market.electricity.ElectricitySpotMarket\") return market")
52  public Iterable<ElectricitySpotMarket> findAllElectricitySpotMarkets();
53 
54  @Query(value = "g.idx('__types__')[[className:'emlab.gen.domain.market.electricity.ElectricitySpotMarket']].toList()", type = QueryType.Gremlin)
55  public List<ElectricitySpotMarket> findAllElectricitySpotMarketsAsList();
56 
57  @Query(value = "start market=node:__types__(\"className:emlab.gen.domain.market.electricity.ElectricitySpotMarket\") return count(market)")
58  double countAllElectricitySpotMarkets();
59 
65  @Query(value = "g.idx('__types__')[[className:'emlab.gen.domain.market.CO2Auction']].next()", type = QueryType.Gremlin)
67 
75  @Query(value = "g.v(zone).in('ZONE').filter{it.__type__=='emlab.gen.domain.market.electricity.ElectricitySpotMarket'}.next()", type = QueryType.Gremlin)
77 
78  @Query(value = "START nationalG = node({nationalG}), electricityMarket = node:__types__(\"className:emlab.gen.domain.market.electricity.ElectricitySpotMarket\") MATCH (nationalG)-[:GOVERNED_ZONE]->(zone)<-[:ZONE]-(electricityMarket) RETURN electricityMarket")
79  public ElectricitySpotMarket findElectricitySpotMarketByNationalGovernment(@Param("nationalG") NationalGovernment nationalG);
80 
81  @Query(value = "g.v(plant).out('LOCATION').out('REGION').in('ZONE').filter{it.__type__=='emlab.gen.domain.market.electricity.ElectricitySpotMarket'}.next()", type = QueryType.Gremlin)
82  public ElectricitySpotMarket findElectricitySpotMarketByPowerPlant(@Param("plant") PowerPlant plant);
83 
84  @Query(value = "segID = g.v(segment).segmentID;"
85  + "return g.v(zone).in('ZONE').filter{it.__type__=='emlab.gen.domain.market.electricity.ElectricitySpotMarket'}.out('SEGMENT_LOAD').as('SL').out('SEGMENTLOAD_SEGMENT').filter{it.segmentID==segID}.back('SL').next();", type = QueryType.Gremlin)
86  public SegmentLoad findSegmentLoadForElectricitySpotMarketForZone(@Param("zone") Zone zone, @Param("segment") Segment segment);
87 
95  @Query(value = "g.v(substance).in('SUBSTANCE_MARKET').next()", type = QueryType.Gremlin)
96  public DecarbonizationMarket findFirstMarketBySubstance(@Param("substance") Substance substance);
97 
98 }
DecarbonizationMarket findFirstMarketBySubstance(@Param("substance") Substance substance)
ElectricitySpotMarket findElectricitySpotMarketForZone(@Param("zone") Zone zone)
Iterable< ElectricitySpotMarket > findAllElectricitySpotMarkets()