use of org.apache.jena.rdf.model.Model in project jena by apache.
the class AbstractTestDatasetWithGraphTextIndex method putTurtleInModel.
private void putTurtleInModel(String turtle, String modelName) {
Model model = modelName != null ? dataset.getNamedModel(modelName) : dataset.getDefaultModel();
Reader reader = new StringReader(turtle);
dataset.begin(ReadWrite.WRITE);
try {
model.read(reader, "", "TURTLE");
dataset.commit();
} finally {
dataset.end();
}
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class AbstractTestDatasetWithTextIndexBase method loadData.
protected void loadData(String turtle) {
Model model = dataset.getDefaultModel();
Reader reader = new StringReader(turtle);
dataset.begin(ReadWrite.WRITE);
model.read(reader, "", "TURTLE");
dataset.commit();
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class TestBuildTextDataset method loadData.
private static void loadData(Dataset dataset) {
dataset.begin(ReadWrite.WRITE);
try {
Model m = dataset.getDefaultModel();
RDFDataMgr.read(m, DIR + "/data1.ttl");
dataset.commit();
} finally {
dataset.end();
}
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class TestDatasetWithLuceneMultilingualTextIndex method before.
@Before
public void before() {
Reader reader = new StringReader(SPEC);
Model specModel = ModelFactory.createDefaultModel();
specModel.read(reader, "", "TURTLE");
TextAssembler.init();
Resource root = specModel.getResource(SPEC_ROOT_URI);
dataset = (Dataset) Assembler.general.open(root);
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class TestDatasetWithLuceneMultilingualTextIndex method testRetrievingSKOSConcepts.
@Test
public void testRetrievingSKOSConcepts() {
String queryString = StrUtils.strjoinNL("PREFIX text: <http://jena.apache.org/text#>", "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>", "PREFIX skos: <http://www.w3.org/2004/02/skos/core#>", "SELECT ?s", "WHERE {", " { ?s text:query ( skos:prefLabel 'frites' 'lang:fr' ) }", " UNION ", " { ?s text:query ( skos:prefLabel 'Kartoffelpüree' 'lang:de' ) }", "}");
Set<String> expectedURIs = new HashSet<>();
expectedURIs.addAll(Arrays.asList("http://example.com/dishes#fries", "http://example.com/dishes#mashed"));
dataset.begin(ReadWrite.WRITE);
Model model = dataset.getDefaultModel();
RDFDataMgr.read(model, DIR + "/data.skos", Lang.RDFXML);
dataset.commit();
doTestQuery(dataset, "", queryString, expectedURIs, expectedURIs.size());
}
Aggregations