org.eclipse.rdf4j.model.util.Models.isSubset()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.eclipse.rdf4j.model.util.Models.isSubset()方法的一些代码示例,展示了Models.isSubset()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Models.isSubset()方法的具体详情如下:
包路径:org.eclipse.rdf4j.model.util.Models
类名称:Models
方法名:isSubset

Models.isSubset介绍

[英]Compares two RDF models, and returns true if the first model is a subset of the second model, using graph isomorphism to map statements between models.
[中]比较两个RDF模型,如果第一个模型是第二个模型的子集,则返回true,使用图同构在模型之间映射语句。

代码示例

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

/**
 * Compares two RDF models, and returns <tt>true</tt> if the first model is a subset of the second model,
 * using graph isomorphism to map statements between models.
 */
public static boolean isSubset(Iterable<? extends Statement> model1, Iterable<? extends Statement> model2)
{
  // Filter duplicates
  Model set1 = toModel(model1);
  Model set2 = toModel(model2);
  return isSubset(set1, set2);
}

代码示例来源:origin: eclipse/rdf4j

/**
 * Compares two RDF models, and returns <tt>true</tt> if the first model is a subset of the second model,
 * using graph isomorphism to map statements between models.
 */
public static boolean isSubset(Iterable<? extends Statement> model1, Iterable<? extends Statement> model2)
{
  // Filter duplicates
  Model set1 = toModel(model1);
  Model set2 = toModel(model2);
  return isSubset(set1, set2);
}

代码示例来源:origin: eclipse/rdf4j

/**
 * Compares the models of the default context of two repositories and returns true if rep1 is a subset of
 * rep2. Note that the method pulls the entire default context of both repositories into main memory. Use
 * with caution.
 */
public static boolean isSubset(Repository rep1, Repository rep2)
  throws RepositoryException
{
  Set<Statement> model1, model2;
  try (RepositoryConnection con1 = rep1.getConnection()) {
    model1 = Iterations.asSet(con1.getStatements(null, null, null, true));
  }
  try (RepositoryConnection con2 = rep2.getConnection()) {
    model2 = Iterations.asSet(con2.getStatements(null, null, null, true));
  }
  return Models.isSubset(model1, model2);
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

/**
 * Compares the models of the default context of two repositories and returns true if rep1 is a subset of
 * rep2. Note that the method pulls the entire default context of both repositories into main memory. Use
 * with caution.
 */
public static boolean isSubset(Repository rep1, Repository rep2)
  throws RepositoryException
{
  Set<Statement> model1, model2;
  RepositoryConnection con1 = rep1.getConnection();
  try {
    model1 = Iterations.asSet(con1.getStatements(null, null, null, true));
  }
  finally {
    con1.close();
  }
  RepositoryConnection con2 = rep2.getConnection();
  try {
    model2 = Iterations.asSet(con2.getStatements(null, null, null, true));
  }
  finally {
    con2.close();
  }
  return Models.isSubset(model1, model2);
}

相关文章