Package org.restlet.ext.rdf.internal.turtle

Examples of org.restlet.ext.rdf.internal.turtle.BlankNodeToken


                    if (!subjects.isEmpty()) {
                        currentSubject = subjects.get(subjects.size() - 1);
                    }
                } else {
                    if ("!".equalsIgnoreCase(lexicalUnit.getValue())) {
                        currentObject = new BlankNodeToken(newBlankNodeId())
                                .resolve();
                        currentPredicate = getPredicate(lexicalUnits.get(++i));
                        this.link(currentSubject, currentPredicate,
                                currentObject);
                        currentSubject = currentObject;
                        nbTokens = 1;
                    } else if ("^".equalsIgnoreCase(lexicalUnit.getValue())) {
                        currentObject = currentSubject;
                        currentPredicate = getPredicate(lexicalUnits.get(++i));
                        currentSubject = new BlankNodeToken(newBlankNodeId())
                                .resolve();
                        this.link(currentSubject, currentPredicate,
                                currentObject);
                        nbTokens = 1;
                    } else {
                        currentSubject = lexicalUnit.resolve();
                        subjects.add(currentSubject);
                    }
                }
                break;
            case 2:
                if ("is".equalsIgnoreCase(lexicalUnit.getValue())) {
                    nbTokens--;
                    swapSubjectObject = true;
                } else if ("has".equalsIgnoreCase(lexicalUnit.getValue())) {
                    nbTokens--;
                } else if ("=".equalsIgnoreCase(lexicalUnit.getValue())) {
                    currentPredicate = RdfConstants.PREDICATE_SAME;
                } else if ("=>".equalsIgnoreCase(lexicalUnit.getValue())) {
                    currentPredicate = RdfConstants.PREDICATE_IMPLIES;
                } else if ("<=".equalsIgnoreCase(lexicalUnit.getValue())) {
                    swapSubjectObject = true;
                    currentPredicate = RdfConstants.PREDICATE_IMPLIES;
                } else if ("a".equalsIgnoreCase(lexicalUnit.getValue())) {
                    currentPredicate = RdfConstants.PREDICATE_TYPE;
                } else if ("!".equalsIgnoreCase(lexicalUnit.getValue())) {
                    currentObject = new BlankNodeToken(newBlankNodeId())
                            .resolve();
                    currentPredicate = getPredicate(lexicalUnits.get(++i));
                    this.link(currentSubject, currentPredicate, currentObject);
                    currentSubject = currentObject;
                    nbTokens = 1;
                } else if ("^".equalsIgnoreCase(lexicalUnit.getValue())) {
                    currentObject = currentSubject;
                    currentPredicate = getPredicate(lexicalUnits.get(++i));
                    currentSubject = new BlankNodeToken(newBlankNodeId())
                            .resolve();
                    this.link(currentSubject, currentPredicate, currentObject);
                    nbTokens = 1;
                } else {
                    currentPredicate = getPredicate(lexicalUnit);
                }
                break;
            case 3:
                if ("of".equalsIgnoreCase(lexicalUnit.getValue())) {
                    nbTokens--;
                } else {
                    // take care of the "path" shorthands.
                    int j = i + 1;
                    if (j < lexicalUnits.size() && isPath(lexicalUnits.get(j))) {
                        if ("!"
                                .equalsIgnoreCase(lexicalUnits.get(j)
                                        .getValue())) {
                            // Create a new BlankNode which is the object of the
                            // current link.
                            currentObject = new BlankNodeToken(newBlankNodeId())
                                    .resolve();
                            this.link(currentSubject, currentPredicate,
                                    currentObject);

                            // Interpret the "!" path
                            currentPredicate = getPredicate(lexicalUnits
                                    .get(j + 1));
                            this.link(lexicalUnit.resolve(), currentPredicate,
                                    currentObject);
                            currentSubject = currentObject;
                            nbTokens = 0;
                            i += 2;
                        } else if ("^".equalsIgnoreCase(lexicalUnits.get(j)
                                .getValue())) {
                            // Create a new BlankNode which is the object of the
                            // current link.
                            currentObject = new BlankNodeToken(newBlankNodeId())
                                    .resolve();
                            this.link(currentSubject, currentPredicate,
                                    currentObject);

                            // Interpret the "^" path
View Full Code Here


                            new UriToken(this, getContext()));
                }
                break;
            case '_':
                blankNode.getLexicalUnits().add(
                        new BlankNodeToken(parseToken()));
                break;
            case '"':
                blankNode.getLexicalUnits().add(
                        new StringToken(this, getContext()));
                break;
            case '[':
                blankNode.getLexicalUnits().add(
                        new BlankNodeToken(this, getContext()));
                break;
            case '!':
                blankNode.getLexicalUnits().add(new Token("!"));
                step();
                discard();
View Full Code Here

                            new UriToken(this, getContext()));
                }
                break;
            case '_':
                listToken.getLexicalUnits().add(
                        new BlankNodeToken(this.parseToken()));
                break;
            case '"':
                listToken.getLexicalUnits().add(
                        new StringToken(this, getContext()));
                break;
            case '[':
                listToken.getLexicalUnits().add(
                        new BlankNodeToken(this, getContext()));
                break;
            case '{':
                listToken.getLexicalUnits().add(
                        new FormulaToken(this, getContext()));
                break;
View Full Code Here

                    stepBack();
                    lexicalUnits.add(new UriToken(this, context));
                }
                break;
            case '_':
                lexicalUnits.add(new BlankNodeToken(parseToken()));
                break;
            case '"':
                lexicalUnits.add(new StringToken(this, context));
                break;
            case '[':
                lexicalUnits.add(new BlankNodeToken(this, context));
                break;
            case '!':
                lexicalUnits.add(new Token("!"));
                step();
                discard();
View Full Code Here

TOP

Related Classes of org.restlet.ext.rdf.internal.turtle.BlankNodeToken

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.