本文整理汇总了Java中org.apache.jena.query.Dataset.removeNamedModel方法的典型用法代码示例。如果您正苦于以下问题:Java Dataset.removeNamedModel方法的具体用法?Java Dataset.removeNamedModel怎么用?Java Dataset.removeNamedModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jena.query.Dataset
的用法示例。
在下文中一共展示了Dataset.removeNamedModel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
@Override
public void delete(URI uri, Map<String, String> parameters, InputStream payload) throws RESTException {
Dataset dataset = ThingDirectory.get().dataset;
dataset.begin(ReadWrite.WRITE);
try {
dataset.getDefaultModel().getResource(uri.toString()).removeProperties();
dataset.removeNamedModel(uri.toString());
deleteToAll(uri.getPath());
dataset.commit();
} catch (Exception e) {
// TODO distinguish between client and server errors
throw new RESTException();
} finally {
dataset.end();
}
}
示例2: delete
import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
@Override
public void delete(URI uri, Map<String, String> parameters, InputStream payload) throws RESTException {
Dataset dataset = ThingDirectory.get().dataset;
dataset.begin(ReadWrite.WRITE);
try {
dataset.getDefaultModel().createResource(uri.toString()).removeProperties();
dataset.removeNamedModel(uri.toString());
deleteToAll(uri.getPath());
dataset.commit();
// Remove from priority queue
ThingDescription td = new ThingDescription(uri.toString());
ThingDirectory.get().tdQueue.remove(td);
ThingDirectory.get().setTimer();
} catch (Exception e) {
// TODO distinguish between client and server errors
throw new RESTException();
} finally {
dataset.end();
}
}
示例3: delete
import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
@Override
public void delete(URI uri, Map<String, String> parameters, InputStream payload) throws RESTException {
Dataset dataset = Repository.get().dataset;
dataset.begin(ReadWrite.WRITE);
try {
dataset.getDefaultModel().getResource(uri.toString()).removeProperties();
dataset.removeNamedModel(uri.toString());
deleteToAll(uri.getPath());
dataset.commit();
} catch (Exception e) {
// TODO distinguish between client and server errors
throw new RESTException();
} finally {
dataset.end();
}
}
示例4: delete
import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
@Override
public void delete(URI uri, Map<String, String> parameters, InputStream payload) throws RESTException {
Dataset dataset = Repository.get().dataset;
dataset.begin(ReadWrite.WRITE);
try {
dataset.getDefaultModel().createResource(uri.toString()).removeProperties();
dataset.removeNamedModel(uri.toString());
deleteToAll(uri.getPath());
dataset.commit();
// Remove from priority queue
ThingDescription td = new ThingDescription(uri.toString());
Repository.get().tdQueue.remove(td);
Repository.get().setTimer();
} catch (Exception e) {
// TODO distinguish between client and server errors
throw new RESTException();
} finally {
dataset.end();
}
}
示例5: empty
import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
public void empty(Location location) {
Dataset dataset = TDBFactory.createDataset(location);
Iterator<String> namesIt = dataset.listNames();
while (namesIt.hasNext()) {
dataset.removeNamedModel(namesIt.next());
}
}
示例6: run
import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
private void run() {
// Make some triples
dsg.clear();
Dataset dataset = dsg.toDataset();
String modelName = "http://example.org/graphs/charles";
String turtle = "@prefix foaf: <http://xmlns.com/foaf/0.1/> ."
+ "@prefix : <http://example.org/> ."
+":charles a foaf:Person ; "
+ " foaf:name \"Charles\" ;"
+ " foaf:knows :jim ."
+ ":jim a foaf:Person ;"
+ " foaf:name \"Jim\" ;"
+ " foaf:knows :charles .";
System.out.println("Make a model and load the turtle into it (client-side)");
Model model = ModelFactory.createDefaultModel();
RDFDataMgr.read(model, new StringReader(turtle), "", Lang.TURTLE);
System.out.println("Store the model in MarkLogic.");
dataset.addNamedModel(modelName, model);
System.out.println("Make a triple by hand.");
Model moreTriples = ModelFactory.createDefaultModel();
Statement statement = ResourceFactory.createStatement(
ResourceFactory.createResource("http://example.org/charles"),
ResourceFactory.createProperty("http://example.org/hasDog"),
ResourceFactory.createResource("http://example.org/vashko")
);
moreTriples.add( statement );
System.out.println("Combine models and save");
model.add(moreTriples);
dataset.addNamedModel(modelName, model);
System.out.println("Get it back into a new model (union of two original ones)");
Model retrievedModel = dataset.getNamedModel(modelName);
System.out.println("Remove model from MarkLogic");
dataset.removeNamedModel(modelName);
}