RYA-377 Fixed a bug where the Rya Streams client couldn't use some of the included Statement parsers.
Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/a51765e0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/a51765e0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/a51765e0 Branch: refs/heads/master Commit: a51765e07af7faf9d0c84a0147b7a31ee1e4c660 Parents: 5e5d7c8 Author: kchilton2 <kevin.e.chil...@gmail.com> Authored: Fri Dec 8 13:27:03 2017 -0500 Committer: caleb <caleb.me...@parsons.com> Committed: Tue Jan 9 15:13:01 2018 -0500 ---------------------------------------------------------------------- extras/rya.streams/client/pom.xml | 48 ++++++++++++++------ .../client/command/LoadStatementsCommand.java | 1 + .../kafka/interactor/KafkaLoadStatements.java | 8 +++- pom.xml | 40 ++++++++-------- 4 files changed, 62 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/a51765e0/extras/rya.streams/client/pom.xml ---------------------------------------------------------------------- diff --git a/extras/rya.streams/client/pom.xml b/extras/rya.streams/client/pom.xml index 2e49952..6febd64 100644 --- a/extras/rya.streams/client/pom.xml +++ b/extras/rya.streams/client/pom.xml @@ -48,6 +48,28 @@ under the License. <artifactId>rya.api</artifactId> </dependency> + <!-- Statement formats we support for loading. --> + <dependency> + <groupId>org.openrdf.sesame</groupId> + <artifactId>sesame-rio-nquads</artifactId> + </dependency> + <dependency> + <groupId>org.openrdf.sesame</groupId> + <artifactId>sesame-rio-ntriples</artifactId> + </dependency> + <dependency> + <groupId>org.openrdf.sesame</groupId> + <artifactId>sesame-rio-rdfxml</artifactId> + </dependency> + <dependency> + <groupId>org.openrdf.sesame</groupId> + <artifactId>sesame-rio-trig</artifactId> + </dependency> + <dependency> + <groupId>org.openrdf.sesame</groupId> + <artifactId>sesame-rio-turtle</artifactId> + </dependency> + <!-- Third Party dependencies --> <dependency> <groupId>com.beust</groupId> @@ -79,27 +101,25 @@ under the License. <build> <plugins> <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptorRefs> - <descriptorRef>jar-with-dependencies</descriptorRef> - </descriptorRefs> - <archive> - <manifest> - <mainClass>org.apache.rya.streams.client.CLIDriver</mainClass> - </manifest> - </archive> - </configuration> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> <executions> <execution> - <id>make-assembly</id> <phase>package</phase> <goals> - <goal>single</goal> + <goal>shade</goal> </goals> + <configuration> + <transformers> + <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <mainClass>org.apache.rya.streams.client.CLIDriver</mainClass> + </transformer> + <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> + </transformers> + </configuration> </execution> </executions> </plugin> </plugins> </build> -</project> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/a51765e0/extras/rya.streams/client/src/main/java/org/apache/rya/streams/client/command/LoadStatementsCommand.java ---------------------------------------------------------------------- diff --git a/extras/rya.streams/client/src/main/java/org/apache/rya/streams/client/command/LoadStatementsCommand.java b/extras/rya.streams/client/src/main/java/org/apache/rya/streams/client/command/LoadStatementsCommand.java index 42020b3..bb31830 100644 --- a/extras/rya.streams/client/src/main/java/org/apache/rya/streams/client/command/LoadStatementsCommand.java +++ b/extras/rya.streams/client/src/main/java/org/apache/rya/streams/client/command/LoadStatementsCommand.java @@ -131,6 +131,7 @@ public class LoadStatementsCommand implements RyaStreamsCommand { statements.fromFile(statementsPath, params.visibilities); } catch (final Exception e) { System.err.println("Unable to parse statements file: " + statementsPath.toString()); + e.printStackTrace(); } } http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/a51765e0/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/interactor/KafkaLoadStatements.java ---------------------------------------------------------------------- diff --git a/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/interactor/KafkaLoadStatements.java b/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/interactor/KafkaLoadStatements.java index d3ec650..cf10f6a 100644 --- a/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/interactor/KafkaLoadStatements.java +++ b/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/interactor/KafkaLoadStatements.java @@ -69,8 +69,14 @@ public class KafkaLoadStatements implements LoadStatements { requireNonNull(statementsPath); requireNonNull(visibilities); + if(!statementsPath.toFile().exists()) { + throw new RyaStreamsException("Could not load statements at path '" + statementsPath + "' because that " + + "does not exist. Make sure you've entered the correct path."); + } + // Create an RDF Parser whose format is derived from the statementPath's file extension. - final RDFParser parser = Rio.createParser(RDFFormat.forFileName(statementsPath.getFileName().toString())); + final RDFFormat format = RDFFormat.forFileName(statementsPath.getFileName().toString()); + final RDFParser parser = Rio.createParser(format); // Set a handler that writes the statements to the specified kafka topic. parser.setRDFHandler(new RDFHandlerBase() { http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/a51765e0/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 6b2ad61..58cc7c5 100644 --- a/pom.xml +++ b/pom.xml @@ -412,57 +412,57 @@ under the License. </dependency> <dependency> <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-rio-rdfxml</artifactId> + <artifactId>sesame-rio-nquads</artifactId> <version>${openrdf.sesame.version}</version> </dependency> - <dependency> + <dependency> <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-queryrender</artifactId> + <artifactId>sesame-rio-ntriples</artifactId> <version>${openrdf.sesame.version}</version> </dependency> <dependency> <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-runtime-osgi</artifactId> + <artifactId>sesame-rio-rdfxml</artifactId> <version>${openrdf.sesame.version}</version> - <exclusions> - <exclusion> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-http-client</artifactId> - </exclusion> - <exclusion> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-http-server-spring</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-rio-ntriples</artifactId> + <artifactId>sesame-rio-trig</artifactId> <version>${openrdf.sesame.version}</version> </dependency> <dependency> <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-rio-nquads</artifactId> + <artifactId>sesame-rio-turtle</artifactId> <version>${openrdf.sesame.version}</version> </dependency> <dependency> <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-rio-trig</artifactId> + <artifactId>sesame-queryrender</artifactId> <version>${openrdf.sesame.version}</version> </dependency> <dependency> <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-queryalgebra-evaluation</artifactId> + <artifactId>sesame-runtime-osgi</artifactId> <version>${openrdf.sesame.version}</version> + <exclusions> + <exclusion> + <groupId>org.openrdf.sesame</groupId> + <artifactId>sesame-http-client</artifactId> + </exclusion> + <exclusion> + <groupId>org.openrdf.sesame</groupId> + <artifactId>sesame-http-server-spring</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-queryresultio-sparqljson</artifactId> + <artifactId>sesame-queryalgebra-evaluation</artifactId> <version>${openrdf.sesame.version}</version> </dependency> <dependency> <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-rio-turtle</artifactId> + <artifactId>sesame-queryresultio-sparqljson</artifactId> <version>${openrdf.sesame.version}</version> </dependency> <dependency>