當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。