Package com.github.jsonldjava.core

Examples of com.github.jsonldjava.core.RDFDataset.addTriple()


            // expecting bnode or object

            // match BNODE values
            if (state.line.startsWith("[")) {
                final String bnode = state.namer.getName();
                result.addTriple(state.curSubject, state.curPredicate, bnode);
                state.advanceLinePosition(1);
                // check for anonymous objects
                if (state.line.startsWith("]")) {
                    state.advanceLinePosition(1);
                    // next we expect a statement or object separator
View Full Code Here


            else if (state.line.startsWith("(")) {
                state.advanceLinePosition(1);
                // check for empty collection
                if (state.line.startsWith(")")) {
                    state.advanceLinePosition(1);
                    result.addTriple(state.curSubject, state.curPredicate, RDF_NIL);
                    // next we expect a statement or object separator
                }
                // otherwise we're inside the collection
                else {
                    final String bnode = state.namer.getName();
View Full Code Here

                    // next we expect a statement or object separator
                }
                // otherwise we're inside the collection
                else {
                    final String bnode = state.namer.getName();
                    result.addTriple(state.curSubject, state.curPredicate, bnode);
                    state.push();
                    state.curSubject = bnode;
                    state.curPredicate = RDF_FIRST;
                    continue;
                }
View Full Code Here

                        iri = state.namer.getName(match.group(0).trim());
                    }
                    if (iri != null) {
                        validateIRI(state, iri);
                        // we have a object
                        result.addTriple(state.curSubject, state.curPredicate, iri);
                    } else {
                        // we have a literal
                        String value = match.group(6);
                        String lang = null;
                        String datatype = null;
View Full Code Here

                        } else if (match.group(15) != null) {
                            // boolean literal
                            value = match.group(15);
                            datatype = XSD_BOOLEAN;
                        }
                        result.addTriple(state.curSubject, state.curPredicate, value, datatype,
                                lang);
                    }
                    state.advanceLinePosition(match.group(0).length());
                } else {
                    throw new JsonLdError(JsonLdError.Error.PARSE_ERROR,
View Full Code Here

                if (!RDF_FIRST.equals(state.curPredicate)) {
                    throw new JsonLdError(JsonLdError.Error.PARSE_ERROR,
                            "Error while parsing Turtle; unexpected ). {line: " + state.lineNumber
                                    + "position: " + state.linePosition + "}");
                }
                result.addTriple(state.curSubject, RDF_REST, RDF_NIL);
                state.pop();
                state.advanceLinePosition(1);
                collectionClosed = true;
            }
View Full Code Here

            }

            // if we're in a collection
            if (RDF_FIRST.equals(state.curPredicate)) {
                final String bnode = state.namer.getName();
                result.addTriple(state.curSubject, RDF_REST, bnode);
                state.curSubject = bnode;
                continue;
            }

            if (collectionClosed) {
View Full Code Here

            // expecting bnode or object

            // match BNODE values
            if (state.line.startsWith("[")) {
                final String bnode = state.namer.getName();
                result.addTriple(state.curSubject, state.curPredicate, bnode);
                state.advanceLinePosition(1);
                // check for anonymous objects
                if (state.line.startsWith("]")) {
                    state.advanceLinePosition(1);
                    // next we expect a statement or object separator
View Full Code Here

            else if (state.line.startsWith("(")) {
                state.advanceLinePosition(1);
                // check for empty collection
                if (state.line.startsWith(")")) {
                    state.advanceLinePosition(1);
                    result.addTriple(state.curSubject, state.curPredicate, RDF_NIL);
                    // next we expect a statement or object separator
                }
                // otherwise we're inside the collection
                else {
                    final String bnode = state.namer.getName();
View Full Code Here

                    // next we expect a statement or object separator
                }
                // otherwise we're inside the collection
                else {
                    final String bnode = state.namer.getName();
                    result.addTriple(state.curSubject, state.curPredicate, bnode);
                    state.push();
                    state.curSubject = bnode;
                    state.curPredicate = RDF_FIRST;
                    continue;
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.