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


Java Model.isEmpty方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.rdf.model.Model.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Model.isEmpty方法的具体用法?Java Model.isEmpty怎么用?Java Model.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.rdf.model.Model的用法示例。


在下文中一共展示了Model.isEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: syncNamedGraph

import com.hp.hpl.jena.rdf.model.Model; //导入方法依赖的package包/类
/**
 * Sync the additions and subtractions to the store via the named graph.
 *
 *   http://www.w3.org/TR/sparql11-update/#deleteInsert
 *   https://wiki.duraspace.org/display/VIVO/The+SPARQL+Update+API
 *
 * @param namedGraph String with named graph.
 * @param additions Jena model with triples to add;
 * @param subtractions Jena model with triples to subtract;
 * @throws IOException
 */
public void syncNamedGraph(String namedGraph, Model additions, Model subtractions) throws IOException {

    if (additions.isEmpty() && subtractions.isEmpty()) {
        log.info("Add and subtract graphs are empty. No changes made to <g>.".replace("<g>", namedGraph));
        return;
    }

    if (!additions.isEmpty()) {
        log.info("ADDing triples: " + additions.size());
        bulkUpdate(namedGraph, additions, "add");
    }

    if (!subtractions.isEmpty()) {
        log.info("DELETEing triples: " + subtractions.size());
        bulkUpdate(namedGraph, subtractions, "remove");
    }
}
 
开发者ID:lawlesst,项目名称:karma2vivo,代码行数:29,代码来源:VIVOSPARQLClient.java

示例2: assertIsomorphic

import com.hp.hpl.jena.rdf.model.Model; //导入方法依赖的package包/类
public static void assertIsomorphic(Model expected, Model actual) {
	if (!actual.isIsomorphicWith(expected)) {
		Model missingStatements = expected.difference(actual);
		Model unexpectedStatements = actual.difference(expected);
		if (missingStatements.isEmpty() && unexpectedStatements.isEmpty()) {
			fail("Models not isomorphic due to duplicate triples; expected: " + 
					asNTriples(expected, expected) +
					" actual: " + asNTriples(actual, expected));
		} else if (missingStatements.isEmpty()) {
			fail("Unexpected statement(s): " + 
					asNTriples(unexpectedStatements, expected));
		} else if (unexpectedStatements.isEmpty()) {
			fail("Missing statement(s): " + 
					asNTriples(missingStatements, expected));
		} else {
			fail("Missing statement(s): " + 
					asNTriples(missingStatements, expected) + 
					" Unexpected statement(s): " + 
					asNTriples(unexpectedStatements, expected));
		}
	}
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:23,代码来源:ModelAssert.java

示例3: updateNamedGraph

import com.hp.hpl.jena.rdf.model.Model; //导入方法依赖的package包/类
/**
 * Post the additions to the store via the named graph.
 *
 *   http://www.w3.org/TR/sparql11-update/#deleteInsert
 *   https://wiki.duraspace.org/display/VIVO/The+SPARQL+Update+API
 *
 * @param namedGraph String with named graph.
 * @param additions Jena model with triples to add;
 * @throws IOException
 */
public void updateNamedGraph(String namedGraph, Model additions) throws IOException {

    if (additions.isEmpty()) {
        log.info("Add and subtract graphs are empty. No changes made to <g>.".replace("<g>", namedGraph));
        return;
    }

    if (!additions.isEmpty()) {
        log.info("ADDing triples: " + additions.size());
        bulkUpdate(namedGraph, additions, "add");
    }
}
 
开发者ID:lawlesst,项目名称:karma2vivo,代码行数:23,代码来源:VIVOSPARQLClient.java


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