org.apache.jena.graph.Graph.isIsomorphicWith()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(162)

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

Graph.isIsomorphicWith介绍

[英]Compare this graph with another using the method described in http://www.w3.org/TR/rdf-concepts#section-Graph-syntax
[中]使用http://www.w3.org/TR/rdf-concepts#section-Graph-syntax中描述的方法将此图与另一个图进行比较

代码示例

代码示例来源:origin: org.apache.jena/jena-core

/**
 * Answer true if the given enhanced graph contains the same nodes and 
 * edges as this graph.  The default implementation delegates this to the
 * underlying graph objects.
 * 
 * @param eg A graph to test
 * @return True if eg is a graph with the same structure as this.
 */
final public boolean isIsomorphicWith(EnhGraph eg) {
  return graph.isIsomorphicWith(eg.graph);
}

代码示例来源:origin: apache/jena

@Override
public boolean isIsomorphicWith(Graph g)
{
  return graph.isIsomorphicWith(g) ;
}

代码示例来源:origin: apache/jena

/**
 * Answer true if the given enhanced graph contains the same nodes and 
 * edges as this graph.  The default implementation delegates this to the
 * underlying graph objects.
 * 
 * @param eg A graph to test
 * @return True if eg is a graph with the same structure as this.
 */
final public boolean isIsomorphicWith(EnhGraph eg) {
  return graph.isIsomorphicWith(eg.graph);
}

代码示例来源:origin: apache/jena

@Override
public boolean isIsomorphicWith( Graph g )
{ return base.isIsomorphicWith( g ); }

代码示例来源:origin: vivo-project/Vitro

@Override
public boolean isIsomorphicWith(Graph arg0) {
  return graph.isIsomorphicWith(arg0);
}

代码示例来源:origin: vivo-project/Vitro

@Override
public boolean isIsomorphicWith(Graph arg0) {
  return g.isIsomorphicWith(arg0);
}

代码示例来源:origin: vivo-project/Vitro

@Override
public boolean isIsomorphicWith(Graph arg0) {
  try {
    regenerateIfClosed();
    return g.isIsomorphicWith(arg0);
  } catch (Exception e) {
    regenerate();
    return g.isIsomorphicWith(arg0);
  }
}

代码示例来源:origin: apache/jena

/**
 Answer whether or not these two graphs are isomorphic.
 */
@Override
public boolean isIsomorphicWith( Model m )
{
  Graph L = this.getGraph();  
  Graph R = m.getGraph();
  return L.isIsomorphicWith( R );
}

代码示例来源:origin: org.apache.jena/jena-core

/**
 Answer whether or not these two graphs are isomorphic.
 */
@Override
public boolean isIsomorphicWith( Model m )
{
  Graph L = this.getGraph();  
  Graph R = m.getGraph();
  return L.isIsomorphicWith( R );
}

代码示例来源:origin: apache/jena

@Test public void post_01()
{
  DatasetGraphAccessor updater = getDatasetUpdater() ;
  updater.httpPost(graph1) ;
  updater.httpPost(graph2) ;
  Graph graph = updater.httpGet() ;
  
  Graph graph3 = GraphFactory.createDefaultGraph() ;
  GraphUtil.addInto(graph3, graph1) ;
  GraphUtil.addInto(graph3, graph2) ;
  assertTrue(graph.isIsomorphicWith(graph3)) ;
  assertFalse(graph.isIsomorphicWith(graph1)) ;
  assertFalse(graph.isIsomorphicWith(graph2)) ;
}

代码示例来源:origin: org.apache.jena/jena-core

/**
 * Assert that the supplied graph <code>got</code> is isomorphic with the
 * the desired graph <code>expected</code>; if not, display a readable
 * description of both graphs.
 */
public static void assertIsomorphic(String title, Graph expected, Graph got) {
  if (!expected.isIsomorphicWith(got)) {
    Map<Node, Object> map = CollectionFactory.createHashedMap();
    fail(title + ": wanted " + nice(expected, map) + "\nbut got "
        + nice(got, map));
  }
}

代码示例来源:origin: apache/jena

/**
  Assert that the supplied graph <code>got</code> is isomorphic with the
  the desired graph <code>expected</code>; if not, display a readable
  description of both graphs.
*/
public static void assertIsomorphic( String title, Graph expected, Graph got )
  {
  if (!expected.isIsomorphicWith( got ))
    {
    Map<Node, Object> map = CollectionFactory.createHashedMap();
    fail( title + ": wanted " + nice( expected, map ) + "\nbut got " + nice( got, map ) );
    }
  }

代码示例来源:origin: apache/jena

/**
 * Assert that the supplied graph <code>got</code> is isomorphic with the
 * the desired graph <code>expected</code>; if not, display a readable
 * description of both graphs.
 */
public static void assertIsomorphic(String title, Graph expected, Graph got) {
  if (!expected.isIsomorphicWith(got)) {
    Map<Node, Object> map = CollectionFactory.createHashedMap();
    fail(title + ": wanted " + nice(expected, map) + "\nbut got "
        + nice(got, map));
  }
}

代码示例来源:origin: apache/jena

private void test (Graph g)
{
  ByteArrayOutputStream bout = serializeAsJSON(g) ;
  parseAsJSON(bout) ; // make sure valid JSON
  Graph g2 = parseAsRDFJSON(bout) ; 
  assertTrue(g.isIsomorphicWith(g2)) ;  
}

代码示例来源:origin: org.apache.jena/jena-core

/**
  Assert that the supplied graph <code>got</code> is isomorphic with the
  the desired graph <code>expected</code>; if not, display a readable
  description of both graphs.
*/
public static void assertIsomorphic( String title, Graph expected, Graph got )
  {
  if (!expected.isIsomorphicWith( got ))
    {
    Map<Node, Object> map = CollectionFactory.createHashedMap();
    fail( title + ": wanted " + nice( expected, map ) + "\nbut got " + nice( got, map ) );
    }
  }

代码示例来源:origin: apache/jena

@Test public void put_01()
{
  DatasetGraphAccessor updater = getDatasetUpdater() ;
  updater.httpPut(graph1) ;
  
  Graph graph = updater.httpGet() ;
  assertNotNull("Graph is null", graph) ;
  assertTrue(graph.isIsomorphicWith(graph1)) ;
}

代码示例来源:origin: apache/jena

@Test public void put_02()
{
  DatasetGraphAccessor updater = getDatasetUpdater() ;
  updater.httpPut(n1, graph1) ;
  
  Graph graph = updater.httpGet() ;
  assertNullOrEmpty(graph) ;
  
  graph = updater.httpGet(n1) ;
  assertNotNull("Graph is null", graph) ;
  assertTrue(graph.isIsomorphicWith(graph1)) ;
}

代码示例来源:origin: apache/jena

@Test
public void nt_model_1() {
  Model m1 = parseToModel("<x> <p> \"abc-\\u00E9\". ");
  assertEquals(1, m1.size());
  Model m2 = parseToModel("<x> <p> \"abc-\\u00E9\". ");
  assertTrue(m1.isIsomorphicWith(m2));
  Graph g1 = SSE.parseGraph("(graph (triple <x> <p> \"abc-é\"))");
  assertTrue(g1.isIsomorphicWith(m1.getGraph()));
}

代码示例来源:origin: apache/jena

@Test public void testUpdateScript5()
{
  DatasetGraph gStore = getEmptyDatasetGraph() ;
  script(gStore, "data-2.ru") ;
  
  
  Graph g = GraphFactory.createPlainGraph() ;
  Node b = org.apache.jena.graph.NodeFactory.createBlankNode() ;
  
  g.add(new Triple(s, p, b)) ;
  g.add(new Triple(b, q, v)) ;
  assertTrue(g.isIsomorphicWith(gStore.getDefaultGraph())) ;
}

代码示例来源:origin: apache/jena

@Test
public void testDifference() {
  final Graph g1 = parseGraph("(graph (triple <s1> <p1> <o1> ))");
  final DatasetGraph dsg1 = DatasetGraphFactory.create(g1);
  final Node graphName1 = NodeFactory.createBlankNode();
  dsg1.addGraph(graphName1, g1);
  final Graph g2 = parseGraph("(graph (triple <s2> <p2> <o2> ))");
  final DatasetGraph dsg2 = DatasetGraphFactory.create(g2);
  final Node graphName2 = NodeFactory.createBlankNode();
  dsg2.addGraph(graphName2, g2);
  DatasetGraph dsg = testInstance(dsg1, dsg2, Context.emptyContext);
  assertEquals(1, dsg.size());
  assertTrue(g1.isIsomorphicWith(dsg.getGraph(graphName1)));
  assertTrue(g1.isIsomorphicWith(dsg.getDefaultGraph()));
  assertTrue(dsg.getGraph(graphName2).isEmpty());
}

相关文章