/
JenaTransformationInjectSemaphoreNeighbor.java
41 lines (34 loc) · 1.74 KB
/
JenaTransformationInjectSemaphoreNeighbor.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*******************************************************************************
* Copyright (c) 2010-2015, Benedek Izso, Gabor Szarnyas, Istvan Rath and Daniel Varro
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Benedek Izso - initial API and implementation
* Gabor Szarnyas - initial API and implementation
*******************************************************************************/
package hu.bme.mit.trainbenchmark.benchmark.jena.transformations.inject;
import java.io.IOException;
import java.util.Collection;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Property;
import hu.bme.mit.trainbenchmark.benchmark.jena.driver.JenaDriver;
import hu.bme.mit.trainbenchmark.benchmark.jena.matches.JenaSemaphoreNeighborInjectMatch;
import hu.bme.mit.trainbenchmark.benchmark.jena.transformations.JenaTransformation;
import hu.bme.mit.trainbenchmark.constants.ModelConstants;
import hu.bme.mit.trainbenchmark.rdf.RdfConstants;
public class JenaTransformationInjectSemaphoreNeighbor extends JenaTransformation<JenaSemaphoreNeighborInjectMatch> {
public JenaTransformationInjectSemaphoreNeighbor(final JenaDriver driver) {
super(driver);
}
@Override
public void activate(final Collection<JenaSemaphoreNeighborInjectMatch> matches) throws IOException {
final Model model = driver.getModel();
final Property entry = model.getProperty(RdfConstants.BASE_PREFIX + ModelConstants.ENTRY);
for (JenaSemaphoreNeighborInjectMatch match : matches) {
model.remove(match.getRoute(), entry, match.getSemaphore());
}
}
}