com.hp.hpl.jena.rdf.model.Model.difference()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(131)

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

Model.difference介绍

[英]Create a new, independant, model containing all the statements in this model which are not in another. The new model need not be of the same type as either this model or the argument model: typically it will be a memory-based model.
[中]创建一个新的独立模型,其中包含此模型中不在另一个模型中的所有语句。新模型不必与此模型或参数模型的类型相同:通常它将是基于内存的模型。

代码示例

代码示例来源:origin: fr.inria.eventcloud/eventcloud-api

/**
 * {@inheritDoc}
 */
@Override
public Model difference(Model model) {
  return super.object.difference(model);
}

代码示例来源:origin: bio2rdf/bio2rdf-scripts

public Model difference(Model model) {
  return model.difference(model);
}

代码示例来源:origin: epimorphics/elda

private boolean compareNormalized(Model a, Model b) {
  Model na = normalizeModel(a);
  Model nb = normalizeModel(b);
  boolean isIso = na.isIsomorphicWith(nb);
  if (!isIso) {
    System.err.println(">> beforehand: " + na.isIsomorphicWith(nb));
    Model shared = na.intersection(nb);
    Model nams = na.difference(shared);
    Model nbms = nb.difference(shared);
    System.err.println(">> shared:");
    shared.write(System.err, "Turtle");
    System.err.println(">> expected [-shared]: ");
    nams.write(System.err, "Turtle");
    System.err.println(">> computed [-shared]: ");
    nbms.write(System.err, "Turtle");
    System.err.println(">> afterhand: " + na.difference(shared).isIsomorphicWith(nb.difference(shared)));
  }
  return isIso;
}

代码示例来源:origin: epimorphics/elda

private void assertContains(Model expect, Model rs)
    {
    if (!rs.containsAll(expect))
      {
      Model spoo = expect.difference( rs );
      StringBuilder them = new StringBuilder();
      for (Statement s: spoo.listStatements().toList())
        {
        them.append( s ).append( "\n" );
        }
//            expect.write( System.err, "Turtle" );
//            rs.write( System.err, "Turtle" );
      System.err.println( them );
      fail( "result set doesn't contain all expected triples: missing\n" + them );
      }
    }

代码示例来源:origin: epimorphics/elda

/**
   Compare <code>expected</code> and <code>obtained</code> for isomorphism. 
   If they are not isomorphic, print out their shared submodel and the two 
   different parts. Answer whether or not they're isomorphic. 
*/
public static boolean compareAndDisplayDifferences( Model expected, Model obtained ) {
  boolean isIso = expected.isIsomorphicWith( obtained );
  if (!isIso)
    {
    Model shared = expected.intersection(obtained);
    System.err.println( ">> shared:" );
    shared.write( System.err, "Turtle" );
    System.err.println( ">> expected [-shared]: " );
    expected.difference(shared).write(System.err, "Turtle" );
    System.err.println( ">> computed [-shared]: " );
    obtained.difference(shared).write(System.err, "Turtle" );
    }
  return isIso;
}

代码示例来源:origin: epimorphics/elda

Model G = given.difference(common), R = recon.difference(common);

代码示例来源:origin: nkons/r2rml-parser

Model differenceModel = resultModel.difference(existingDbModel);
StmtIterator stmtDiffIter = differenceModel.listStatements();
while (stmtDiffIter.hasNext()) {

相关文章

Model类方法