use of org.apache.jena.rdf.model.Resource in project jena by apache.
the class SchemagenMojo method processFile.
/**
* Delegate the processing of the given file to schemagen itself
* @param fileName
* @throws SchemagenOptionsConfigurationException
*/
protected void processFile(String fileName) throws MojoExecutionException, SchemagenOptionsConfigurationException {
getLog().info("processFile with " + fileName);
getLog().info(optIndex.keySet().toString());
SchemagenOptions so = optIndex.get(fileName);
getLog().info("so = " + so);
// if we have no options carrier for this file, we create one to contain
// the name of the input file, and link it to the defaults
String soFileName;
if (so == null) {
so = new SchemagenOptions(getDefaultOptions().getOutputOption());
soFileName = fileName;
so.setParent(getDefaultOptions());
} else {
soFileName = so.getOption(OPT.INPUT).asLiteral().getString();
}
getLog().info("input before adjustment: " + soFileName);
boolean relative = !(soFileName.startsWith("http:") || soFileName.startsWith("https:") || soFileName.startsWith("file:"));
getLog().info("relative = " + relative);
getLog().info("baseDir = " + baseDir);
getLog().info("getBaseDir() = " + getBaseDir());
soFileName = relative ? "file:" + baseDir + File.separator + soFileName : soFileName;
//fix windows paths
if (File.separator.equals("\\")) {
soFileName = soFileName.replaceAll("\\\\", "/");
}
getLog().info("input after adjustment: " + soFileName);
Resource input = ResourceFactory.createResource(soFileName);
so.setOption(OPT.INPUT, input);
getLog().info("about to call run(): ");
ensureTargetDirectory(so);
new SchemagenAdapter().run(so);
}
use of org.apache.jena.rdf.model.Resource in project jena by apache.
the class SchemagenOptionsTest method testGetResourceValueOPT3.
@Test
public void testGetResourceValueOPT3() throws SchemagenOptionsConfigurationException {
SchemagenOptions so0 = new SchemagenOptions();
SchemagenOptions so1 = new SchemagenOptions();
so0.setParent(so1);
Resource r0 = ResourceFactory.createResource("http://example.org/foo");
Resource r1 = ResourceFactory.createResource("http://example.org/bar");
so0.setOption(OPT.ROOT, r0);
so1.setOption(OPT.ROOT, r1);
assertEquals(r0, so0.getResource(OPT.ROOT));
}
use of org.apache.jena.rdf.model.Resource in project jena by apache.
the class TestConcurrentAccess method mrswGraph6.
@Test(expected = ConcurrentModificationException.class)
public void mrswGraph6() {
Dataset d = TDBFactory.createDataset();
Model m = d.getNamedModel("http://example");
GraphUtil.addInto(m.getGraph(), buildGraph());
Resource r = m.createResource("x");
ExtendedIterator<Statement> iter1 = m.listStatements(r, null, (RDFNode) null);
assertNotNull(iter1.next());
Triple t = SSE.parseTriple("(<y> <p> 99)");
m.getGraph().delete(t);
iter1.next();
}
use of org.apache.jena.rdf.model.Resource in project jena by apache.
the class TestDatasetTDB method load2.
private static void load2(Model model) {
Resource r2 = model.createResource(base1 + "r2");
Property p1 = model.createProperty(baseNS + "p1");
model.add(r2, p1, "x1");
model.add(r2, p1, "x2");
}
use of org.apache.jena.rdf.model.Resource in project jena by apache.
the class TestConcurrentAccess method mrswGraph5.
@Test
public void mrswGraph5() {
Dataset d = TDBFactory.createDataset();
Model m = d.getNamedModel("http://example");
GraphUtil.addInto(m.getGraph(), buildGraph());
Resource r = m.createResource("x");
ExtendedIterator<Statement> iter1 = m.listStatements(r, null, (RDFNode) null);
while (iter1.hasNext()) iter1.next();
Triple t = SSE.parseTriple("(<y> <p> 99)");
m.getGraph().delete(t);
iter1.hasNext();
}
Aggregations