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

x33g5p2x  于2022-01-29 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(83)

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

Triple.toString介绍

[英]return a human-readable string "subject @predicate object" describing the triple
[中]

代码示例

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

/**
  return a human-readable string "subject @predicate object" describing the triple
*/
@Override
public String toString()
  { return toString( PrefixMapping.Standard ); }

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

public AccessDeniedException( String message, Triple triple )
  { 
  super( message + triple.toString() ); 
  this.triple = triple;
  }

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

public AccessDeniedException( String message, Triple triple )
  { 
  super( message + triple.toString() ); 
  this.triple = triple;
  }

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

/**
  return a human-readable string "subject @predicate object" describing the triple
*/
@Override
public String toString()
  { return toString( PrefixMapping.Standard ); }

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

@Override
public void triple(int line, int col, Triple triple)
{
  System.out.print(mark(line, col)) ;
  System.out.print(" ") ;
  System.out.println(triple.toString()) ;
}

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

@Override
public void triple(int line, int col, Triple triple)
{
  System.out.print(mark(line, col)) ;
  System.out.print(" ") ;
  System.out.println(triple.toString()) ;
}

代码示例来源:origin: franzinc/agraph-java-client

/**
 * Returns a human-consumable representation of <code>graph</code>. The string
 * <code>prefix</code> will appear at the beginning of the string. Nodes
 * may be prefix-compressed using <code>graph</code>'s prefix-mapping. This
 * default implementation will display all the triples exposed by the graph,
 * including reification triples.
 *
 * @param prefix the prefix of the string returned
 * @param graph  the Graph to render into a string
 * @return String  a human-consumable representation of the argument Graph
 */
public static String toString(String prefix, Graph graph) {
  // PrefixMapping pm = graph.getPrefixMapping();
  StringBuilder b = new StringBuilder(prefix + " {");
  String gap = "";
  ClosableIterator<Triple> it = GraphUtil.findAll(graph);
  while (it.hasNext()) {
    b.append(gap);
    gap = "; ";
    b.append(it.next().toString());
  }
  b.append("}");
  return b.toString();
}

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

/**
  Primarily to make sure that literals get quoted and stuff comes out in some
  kind of coherent order.
*/
public void testTripleToStringOrdering()
  {
  Triple t1 = NodeCreateUtils.createTriple( "subject predicate object" );
  assertTrue( "subject must be present", t1.toString().contains( "subject" ) );
  assertTrue( "subject must preceed predicate", t1.toString().indexOf( "subject" ) < t1.toString().indexOf( "predicate" ) );
  assertTrue( "predicate must preceed object", t1.toString().indexOf( "predicate" ) < t1.toString().indexOf( "object" ) );
  }

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

/**
  Primarily to make sure that literals get quoted and stuff comes out in some
  kind of coherent order.
*/
public void testTripleToStringOrdering()
  {
  Triple t1 = NodeCreateUtils.createTriple( "subject predicate object" );
  assertTrue( "subject must be present", t1.toString().contains( "subject" ) );
  assertTrue( "subject must preceed predicate", t1.toString().indexOf( "subject" ) < t1.toString().indexOf( "predicate" ) );
  assertTrue( "predicate must preceed object", t1.toString().indexOf( "predicate" ) < t1.toString().indexOf( "object" ) );
  }

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

/**
   Answer a human-consumable representation of <code>that</code>. The 
   string <code>prefix</code> will appear near the beginning of the string. Nodes
   may be prefix-compressed using <code>that</code>'s prefix-mapping. This
   default implementation will display all the triples exposed by the graph (ie
   including reification triples if it is Standard).
*/
public static String toString( String prefix, Graph that )
  {
  PrefixMapping pm = that.getPrefixMapping();
  StringBuilder b = new StringBuilder( prefix + " {" );
  int count = 0;
  String gap = "";
  ClosableIterator<Triple> it = GraphUtil.findAll( that );
  while (it.hasNext() && count < TOSTRING_TRIPLE_LIMIT) 
    {
    b.append( gap );
    gap = "; ";
    count += 1;
    b.append( it.next().toString( pm ) );
    } 
  if (it.hasNext()) b.append( "..." );
  it.close();
  b.append( "}" );
  return b.toString();
  }

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

/**
   Answer a human-consumable representation of <code>that</code>. The 
   string <code>prefix</code> will appear near the beginning of the string. Nodes
   may be prefix-compressed using <code>that</code>'s prefix-mapping. This
   default implementation will display all the triples exposed by the graph (ie
   including reification triples if it is Standard).
*/
public static String toString( String prefix, Graph that )
  {
  PrefixMapping pm = that.getPrefixMapping();
  StringBuilder b = new StringBuilder( prefix + " {" );
  int count = 0;
  String gap = "";
  ClosableIterator<Triple> it = GraphUtil.findAll( that );
  while (it.hasNext() && count < TOSTRING_TRIPLE_LIMIT) 
    {
    b.append( gap );
    gap = "; ";
    count += 1;
    b.append( it.next().toString( pm ) );
    } 
  if (it.hasNext()) b.append( "..." );
  it.close();
  b.append( "}" );
  return b.toString();
  }

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

public void testTripleToStringQuoting()
  {
  Triple t1 = NodeCreateUtils.createTriple( "subject predicate 'object'" );
  assertTrue( t1.toString().indexOf( "\"object\"") > 0 );
  }

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

public void testTripleToStringQuoting()
  {
  Triple t1 = NodeCreateUtils.createTriple( "subject predicate 'object'" );
  assertTrue( t1.toString().indexOf( "\"object\"") > 0 );
  }

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

public void testTripleToStringWithPrefixing()
  {
  PrefixMapping pm = PrefixMapping.Factory.create();
  pm.setNsPrefix( "spoo", "eg://domain.dom/spoo#" );
  Triple t1 = NodeCreateUtils.createTriple( "eg://domain.dom/spoo#a b c" );
  assertEquals( "spoo:a @eh:/b eh:/c", t1.toString( pm ) );
  }

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

public void testTripleToStringWithPrefixing()
  {
  PrefixMapping pm = PrefixMapping.Factory.create();
  pm.setNsPrefix( "spoo", "eg://domain.dom/spoo#" );
  Triple t1 = NodeCreateUtils.createTriple( "eg://domain.dom/spoo#a b c" );
  assertEquals( "spoo:a @eh:/b eh:/c", t1.toString( pm ) );
  }

代码示例来源:origin: HuygensING/timbuctoo

LOG.error("Triple matches no pattern: ", triple.toString());

相关文章