Java Code Examples for org.apache.jena.riot.tokens.Token#getLine()

The following examples show how to use org.apache.jena.riot.tokens.Token#getLine() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RdflintParserTurtle.java    From rdflint with MIT License 6 votes vote down vote up
@Override
public Node create(Node currentGraph, Token token) {
  int line = (int) token.getLine();
  int col = (int) token.getColumn();
  String str = token.getImage();
  validationModels.forEach(m -> {
    Node node = null;
    int length = 0;
    if (token.getType() == TokenType.PREFIXED_NAME) {
      String prefix = str;
      String suffix = token.getImage2();
      String expansion = expandPrefixedName(prefix, suffix);
      node = createURI(expansion, line, col);
      length = str.length() + suffix.length();
    } else if (token.getType() == TokenType.IRI) {
      node = createURI(str, line, col);
      length = str.length();
    }
    if (node != null) {
      List<LintProblem> diagnostic = m
          .validateNode(node, line, col, line, col + length);
      diagnosticList.addAll(diagnostic);
    }
  });
  return super.create(currentGraph, token);
}
 
Example 2
Source File: EmbeddedTripleTokenUtils.java    From RDFstarTools with Apache License 2.0 5 votes vote down vote up
static protected void setSubTokens( final Token t, final Token s, final Token p, final Token o ) {
   	final Token po = new Token(p.getLine(), p.getColumn());
   	po.setSubToken1(p);
   	po.setSubToken2(o);

   	t.setSubToken1(s);
   	t.setSubToken2(po);
}