当前位置: 首页>>代码示例>>Java>>正文


Java Dataset.removeNamedModel方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:thingweb,项目名称:thingweb-directory,代码行数:18,代码来源:VocabularyHandler.java

示例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();
	}
}
 
开发者ID:thingweb,项目名称:thingweb-directory,代码行数:23,代码来源:ThingDescriptionHandler.java

示例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();
	}
}
 
开发者ID:thingweb,项目名称:thingweb-repository,代码行数:18,代码来源:VocabularyHandler.java

示例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();
	}
}
 
开发者ID:thingweb,项目名称:thingweb-repository,代码行数:23,代码来源:ThingDescriptionHandler.java

示例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());
		}
	}
 
开发者ID:AnLiGentile,项目名称:cLODg,代码行数:9,代码来源:JenaTDBTriplestoreBuilder.java

示例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);
}
 
开发者ID:marklogic,项目名称:marklogic-jena,代码行数:42,代码来源:ModelCRUDExample.java


注:本文中的org.apache.jena.query.Dataset.removeNamedModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。