Package org.openjena.riot.tokens

Examples of org.openjena.riot.tokens.Token


    protected abstract void emit(Node subject, Node predicate, Node object) ;

    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


        expect("Prefix directive not terminated by a dot", DOT) ;
    }

    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) ;
        nextToken() ;

        expect("Base directive not terminated by a dot", DOT) ;
        profile.getPrologue().setBaseURI(baseIRI) ;
View Full Code Here

    static protected final Node nodeLogImplies = Node.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) )
        {
            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

        }

        Tokenizer tokenizer = TokenizerFactory.makeTokenizerString(str) ;
        if ( ! tokenizer.hasNext() )
            throw new TDBException("Failed to tokenise: "+str) ;
        Token t = tokenizer.next() ;

        try {
            Node n = t.asNode() ;
            if ( n == null ) throw new TDBException("Not a node: "+str) ;
            return n ;
        } catch (RiotException ex)
        {
            throw new TDBException("Bad string for node: "+str) ;
View Full Code Here

    public static Node parseNode(String nodeString, PrefixMap pmap)
    {
        Tokenizer tokenizer = TokenizerFactory.makeTokenizerString(nodeString) ;
        if ( ! tokenizer.hasNext() )
            throw new RiotException("Empty RDF term") ;
        Token token = tokenizer.next() ;
        Node node = token.asNode(pmap) ;
        if ( node == null )
            throw new RiotException("Bad RDF Term: "+nodeString) ;

        if ( tokenizer.hasNext() )
            throw new RiotException("Trailing characters in string: "+nodeString) ;
View Full Code Here

    public static Node parse(String string)
    {
        Tokenizer tokenizer = TokenizerFactory.makeTokenizerString(string) ;
        if ( ! tokenizer.hasNext() )
            return null ;
        Token t = tokenizer.next();
        Node n = profile.create(null, t) ;
        if ( tokenizer.hasNext() )
            Log.warn(RiotLib.class, "String has more than one token in it: "+string) ;
        return n ;
    }
View Full Code Here

    public static Node parse(String string) {
        Tokenizer tokenizer = TokenizerFactory.makeTokenizerString(string) ;
        if ( ! tokenizer.hasNext() )
            return null ;
        Token t = tokenizer.next();
        Node n = profile.create(null, t) ;
        if ( tokenizer.hasNext() )
            Log.warn(RiotLib.class, "String has more than one token in it: "+string) ;
        return n ;
    }
View Full Code Here

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

TOP

Related Classes of org.openjena.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.