EMlab-generation Documentation  1.0
Documentation of the EMLab-Generation model.
SegmentClearingPointRepository.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 org.springframework.data.neo4j.annotation.Query;
19 import org.springframework.data.neo4j.annotation.QueryType;
20 import org.springframework.data.neo4j.repository.GraphRepository;
21 import org.springframework.data.repository.query.Param;
22 
26 
27 public interface SegmentClearingPointRepository extends GraphRepository<SegmentClearingPoint> {
28 
29  @Query("START scp=node:__types__(\"className:emlab.gen.domain.market.electricity.SegmentClearingPoint\") WHERE (scp.time={time} AND scp.forecast={forecast}) RETURN scp")
30  Iterable<SegmentClearingPoint> findAllSegmentClearingPointsForTime(@Param("time") long time,
31  @Param("forecast") boolean forecast);
32 
33  @Query("START segment = node({segment}), scp=node:__types__(\"className:emlab.gen.domain.market.electricity.SegmentClearingPoint\") MATCH (segment)<-[:SEGMENT_POINT]-(scp) WHERE (scp.time = {time} AND scp.forecast={forecast}) RETURN scp")
34  Iterable<SegmentClearingPoint> findAllSegmentClearingPointsForSegmentAndTime(@Param("time") long time,
35  @Param("segment") Segment segment, @Param("forecast") boolean forecast);
36 
37  // @Query("START segment = node({segment}), market=node({market}) MATCH (segment)<-[:SEGMENT_POINT]-(scp)-[:MARKET_POINT]->(market) WHERE (scp.time = {time}) RETURN scp")
38  // SegmentClearingPoint findOneSegmentClearingPointForMarketSegmentAndTime(@Param("time") long time, @Param("segment") Segment segment,
39  // @Param("market") ElectricitySpotMarket electricitySpotMarket);
40 
41  @Query(value = "g.v(segment).in('SEGMENT_POINT').propertyFilter('time', FilterPipe.Filter.EQUAL, time).propertyFilter('forecast', FilterPipe.Filter.EQUAL, forecast).as('x').out('MARKET_POINT').idFilter(market, FilterPipe.Filter.EQUAL).back('x')", type = QueryType.Gremlin)
42  SegmentClearingPoint findOneSegmentClearingPointForMarketSegmentAndTime(@Param("time") long time, @Param("segment") Segment segment,
43  @Param("market") ElectricitySpotMarket electricitySpotMarket,
44  @Param("forecast") boolean forecast);
45 }