Search in sources :

Example 1 with IRI

use of org.apache.jena.riot.tokens.TokenType.IRI in project jena by apache.

the class LangTurtleBase method directiveBase.

protected final void directiveBase() {
    Token token = peekToken();
    if (!lookingAt(IRI))
        exception(token, "@base requires an IRI (found '" + token + "')");
    String baseStr = token.getImage();
    IRI baseIRI = profile.makeIRI(baseStr, currLine, currCol);
    emitBase(baseIRI.toString());
    nextToken();
    IRIResolver newResolver = IRIResolver.create(baseIRI);
    profile.setIRIResolver(newResolver);
}
Also used : IRI(org.apache.jena.riot.tokens.TokenType.IRI) IRI(org.apache.jena.iri.IRI) Token(org.apache.jena.riot.tokens.Token)

Example 2 with IRI

use of org.apache.jena.riot.tokens.TokenType.IRI in project jena by apache.

the class LangTurtleBase method directivePrefix.

protected final void directivePrefix() {
    // Raw - unresolved prefix name.
    if (!lookingAt(PREFIXED_NAME))
        exception(peekToken(), "@prefix or PREFIX requires a prefix (found '" + peekToken() + "')");
    if (peekToken().getImage2().length() != 0)
        exception(peekToken(), "@prefix or PREFIX requires a prefix with no suffix (found '" + peekToken() + "')");
    String prefix = peekToken().getImage();
    nextToken();
    if (!lookingAt(IRI))
        exception(peekToken(), "@prefix requires an IRI (found '" + peekToken() + "')");
    String iriStr = peekToken().getImage();
    IRI iri = profile.makeIRI(iriStr, currLine, currCol);
    prefixMap.add(prefix, iri);
    emitPrefix(prefix, iri.toString());
    nextToken();
}
Also used : IRI(org.apache.jena.riot.tokens.TokenType.IRI) IRI(org.apache.jena.iri.IRI)

Aggregations

IRI (org.apache.jena.iri.IRI)2 IRI (org.apache.jena.riot.tokens.TokenType.IRI)2 Token (org.apache.jena.riot.tokens.Token)1