Package org.apache.jena.riot.tokens

Examples of org.apache.jena.riot.tokens.Token


    protected final void expect(String msg, TokenType ttype)
    {
       
        if ( ! lookingAt(ttype) )
        {
            Token location = peekToken() ;
            exception(location, msg) ;
        }
        nextToken() ;
    }
View Full Code Here


            Timer timer = new Timer() ;
            long count = 0 ;
            timer.startTimer() ;
            for ( ; tokenize.hasNext() ; )
            {
                Token t = tokenize.next() ;
                if ( print )
                    System.out.println(t) ;
                count++ ;
            }
            tokenize.close();
View Full Code Here

                return createTypedLiteral(str, XSDDatatype.XSDdouble, line, col) ;
            case INTEGER:
                return createTypedLiteral(str, XSDDatatype.XSDinteger, line, col) ;
            case LITERAL_DT :
            {
                Token tokenDT = token.getSubToken2() ;
                String uriStr ;
               
                switch(tokenDT.getType())
                {
                    case IRI:               uriStr = tokenDT.getImage() ; break ;
                    case PREFIXED_NAME:
                    {
                        String prefix = tokenDT.getImage() ;
                        String suffix = tokenDT.getImage2() ;
                        uriStr = expandPrefixedName(prefix, suffix, tokenDT) ;
                        break ;
                    }
                    default:
                        throw new RiotException("Expected IRI for datatype: "+token) ;
                }
               
                uriStr = resolveIRI(uriStr, tokenDT.getLine(), tokenDT.getColumn()) ;
                RDFDatatype dt = NodeFactory.getType(uriStr) ;
                return createTypedLiteral(str, dt, line, col) ;
            }
           
            case LITERAL_LANG :
View Full Code Here

    @Override
    protected final void runParser()
    {
        while(moreTokens())
        {
            Token t = peekToken() ;
            if ( lookingAt(DIRECTIVE) )
            {
                directive() ;
                continue ;
            }
View Full Code Here

    /** Emit a triple - nodes have been checked as has legality of node type in location */
    protected abstract void emit(Node subject, Node predicate, Node object) ;

    protected final void toplevelkeyword()
    {
        Token t = peekToken() ;
        String x = t.getImage() ;
        nextToken() ;
       
        if ( x.equalsIgnoreCase("BASE") )
        {
            directiveBase() ;
View Full Code Here

    }
   
    protected final void directive()
    {
        // It's a directive ...
        Token t = peekToken() ;
        String x = t.getImage() ;
        nextToken() ;
       
        if ( x.equals("base") )
        {
            directiveBase() ;
View Full Code Here

        nextToken() ;
    }

    protected final void directiveBase()
    {
        Token token = peekToken() ;
        if ( ! lookingAt(IRI) )
            exception(token, "@base requires an IRI (found '"+token+"')") ;

        String baseStr = token.getImage() ;
        dest.base(baseStr) ;
        IRI baseIRI = profile.makeIRI(baseStr, currLine, currCol) ;
        nextToken() ;
        profile.getPrologue().setBaseURI(baseIRI) ;
    }
View Full Code Here

    static protected final Node nodeLogImplies = NodeFactory.createURI("http://www.w3.org/2000/10/swap/log#implies") ;
   
    /** Get predicate - maybe null for "illegal" */
    protected final Node predicate()
    {
        Token t = peekToken() ;
       
        if ( t.hasType(TokenType.KEYWORD) )
        {
            boolean strict =  profile.isStrictMode() ;
            Token tErr = peekToken() ;
            String image = peekToken().getImage() ;
            if ( image.equals(KW_A) )
                return NodeConst.nodeRDFType ;
            if ( !strict && image.equals(KW_SAME_AS) )
                return nodeSameAs ;
View Full Code Here

        }

        // Special words.
        if ( lookingAt(TokenType.KEYWORD) )
        {
            Token tErr = peekToken() ;
            // Location independent node words
            String image = peekToken().getImage() ;
            nextToken() ;
            if ( image.equals(KW_TRUE) )
                return NodeConst.nodeTrue ;
View Full Code Here

       
        startList() ;
       
        for ( ;; )
        {
            Token errorToken = peekToken() ;
            if ( eof() )
                exception (peekToken(), "Unterminated list") ;
           
            if ( lookingAt(RPAREN) )
            {
View Full Code Here

TOP

Related Classes of org.apache.jena.riot.tokens.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.