in src/main/java/com/amazonaws/services/neptune/cli/RdfExportScopeModule.java [39:65]
public ExportRdfJob createJob(NeptuneSparqlClient client, RdfTargetConfig targetConfig){
if (scope == RdfExportScope.graph){
if (StringUtils.isNotEmpty(namedGraph)) {
//Test that namedGraph is a valid URI
try {
new URL(namedGraph).toURI();
} catch (Exception e) {
throw new IllegalArgumentException("Invalid named-graph URI provided", e);
}
}
return new ExportRdfGraphJob(client, targetConfig, namedGraph);
} else if (scope == RdfExportScope.edges){
if (StringUtils.isNotEmpty(namedGraph)){
throw new IllegalStateException("`--named-graph` can only be used with `--rdf-export-scope graph`");
}
return new ExportRdfEdgesJob(client, targetConfig);
} else if (scope == RdfExportScope.query){
if (StringUtils.isNotEmpty(namedGraph)){
throw new IllegalStateException("`--named-graph` can only be used with `--rdf-export-scope graph`");
}
if (StringUtils.isEmpty(query)){
throw new IllegalStateException("You must supply a SPARQL query if exporting from a query");
}
return new ExportRdfFromQuery(client, targetConfig, query);
}
throw new IllegalStateException(String.format("Unknown export scope: %s", scope));
}