if (isIRI() || isBlankNode()) { return newMap("@id", getValue()); final Map<String, Object> rval = newMap("@value", getValue()); if (getLanguage() != null) { rval.put("@language", getLanguage()); final String type = getDatatype(); final String value = getValue(); if (useNativeTypes) {
if (subjectNode.isPresent() && subjectNode.get().compareTo(q.getSubject()) != 0) { return false; if (predicateNode.isPresent() && predicateNode.get().compareTo(q.getPredicate()) != 0) { return false; if (object instanceof Literal && q.getObject().isLiteral()) { if (objectNode.get().compareTo(q.getObject()) != 0) { return false;
final String subject = triple.getSubject().getValue(); final String predicate = triple.getPredicate().getValue(); final RDFDataset.Node object = triple.getObject(); if ((object.isIRI() || object.isBlankNode()) && !nodeMap.containsKey(object.getValue())) { nodeMap.put(object.getValue(), new NodeMapNode(object.getValue())); if (RDF_TYPE.equals(predicate) && (object.isIRI() || object.isBlankNode()) && !opts.getUseRdfType()) { JsonLdUtils.mergeValue(node, "@type", object.getValue()); continue; final Map<String, Object> value = object.toObject(opts.getUseNativeTypes()); if (object.isBlankNode() || object.isIRI()) { nodeMap.get(object.getValue()).usages .add(new UsagesNode(node, predicate, value));
final String subject = triple.getSubject().getValue(); final String predicate = triple.getPredicate().getValue(); final RDFDataset.Node object = triple.getObject(); nodes.computeIfAbsent(subject, k -> new ArrayList<>()) if ((object.isIRI() || object.isBlankNode())) { nodeMap.computeIfAbsent(object.getValue(), k -> new NodeMapNode(k)); if (RDF_TYPE.equals(predicate) && (object.isIRI() || object.isBlankNode()) && !opts.getUseRdfType() && !nodes.containsKey(object.getValue())) { JsonLdUtils.mergeValue(node, JsonLdConsts.TYPE, object.getValue()); continue; final Map<String, Object> value = object.toObject(opts.getUseNativeTypes()); if (object.isBlankNode() || object.isIRI()) { nodeMap.get(object.getValue()).usages .add(new UsagesNode(node, predicate, value));
final String subject = triple.getSubject().getValue(); final String predicate = triple.getPredicate().getValue(); final RDFDataset.Node object = triple.getObject(); nodes.computeIfAbsent(subject, k -> new ArrayList<>()) if ((object.isIRI() || object.isBlankNode())) { nodeMap.computeIfAbsent(object.getValue(), k -> new NodeMapNode(k)); if (RDF_TYPE.equals(predicate) && (object.isIRI() || object.isBlankNode()) && !opts.getUseRdfType() && !nodes.containsKey(object.getValue())) { JsonLdUtils.mergeValue(node, JsonLdConsts.TYPE, object.getValue()); continue; final Map<String, Object> value = object.toObject(opts.getUseNativeTypes()); if (object.isBlankNode() || object.isIRI()) { nodeMap.get(object.getValue()).usages .add(new UsagesNode(node, predicate, value));
if (isIRI() || isBlankNode()) { return newMap("@id", getValue()); final Map<String, Object> rval = newMap("@value", getValue()); if (getLanguage() != null) { rval.put("@language", getLanguage()); final String type = getDatatype(); final String value = getValue(); if (useNativeTypes) {
if (isIRI() || isBlankNode()) { return newMap("@id", getValue()); final Map<String, Object> rval = newMap("@value", getValue()); if (getLanguage() != null) { rval.put("@language", getLanguage()); final String type = getDatatype(); final String value = getValue(); if (useNativeTypes) {
if (s.isIRI()) { output.append("<"); escape(s.getValue(), output); output.append(">"); output.append(bnode.equals(s.getValue()) ? "_:a" : "_:z"); output.append(s.getValue()); if (p.isIRI()) { output.append(" <"); escape(p.getValue(), output); output.append("> "); escape(p.getValue(), output); output.append(" "); if (o.isIRI()) { output.append("<"); escape(o.getValue(), output); output.append(">"); } else if (o.isBlankNode()) { output.append(bnode.equals(o.getValue()) ? "_:a" : "_:z"); output.append(o.getValue()); escape(o.getValue(), output); output.append("\"");
if (s.isIRI()) { output.append("<"); escape(s.getValue(), output); output.append(">"); output.append(bnode.equals(s.getValue()) ? "_:a" : "_:z"); output.append(s.getValue()); if (p.isIRI()) { output.append(" <"); escape(p.getValue(), output); output.append("> "); escape(p.getValue(), output); output.append(" "); if (o.isIRI()) { output.append("<"); escape(o.getValue(), output); output.append(">"); } else if (o.isBlankNode()) { output.append(bnode.equals(o.getValue()) ? "_:a" : "_:z"); output.append(o.getValue()); escape(o.getValue(), output); output.append("\"");
if (quad.getObject().isLiteral()) { triple(quad.getSubject().getValue(), quad.getPredicate().getValue(), quad.getObject().getValue(), quad.getObject().getDatatype(), quad.getObject().getLanguage(), graphName); triple(quad.getSubject().getValue(), quad.getPredicate().getValue(), quad.getObject().getValue(), graphName);
if (s.isIRI()) { quad += "<" + escape(s.getValue()) + ">"; quad += bnode.equals(s.getValue()) ? "_:a" : "_:z"; quad += s.getValue(); if (p.isIRI()) { quad += " <" + escape(p.getValue()) + "> "; quad += " " + escape(p.getValue()) + " "; if (o.isIRI()) { quad += "<" + escape(o.getValue()) + ">"; } else if (o.isBlankNode()) { quad += bnode.equals(o.getValue()) ? "_:a" : "_:z"; quad += o.getValue(); final String escaped = escape(o.getValue()); quad += "\"" + escaped + "\""; if (RDF_LANGSTRING.equals(o.getDatatype())) { quad += "@" + o.getLanguage(); } else if (!XSD_STRING.equals(o.getDatatype())) { quad += "^^<" + escape(o.getDatatype()) + ">";
if (quad.getObject().isLiteral()) { triple(quad.getSubject().getValue(), quad.getPredicate().getValue(), quad .getObject().getValue(), quad.getObject().getDatatype(), quad .getObject().getLanguage(), graphName); } else { triple(quad.getSubject().getValue(), quad.getPredicate().getValue(), quad .getObject().getValue(), graphName);
if (quad.getObject().isLiteral()) { triple(quad.getSubject().getValue(), quad.getPredicate().getValue(), quad.getObject().getValue(), quad.getObject().getDatatype(), quad.getObject().getLanguage(), graphName); triple(quad.getSubject().getValue(), quad.getPredicate().getValue(), quad.getObject().getValue(), graphName);
for (final RDFDataset.Quad quad : quads) { String subject = quad.getSubject().getValue(); String predicate = quad.getPredicate().getValue(); RDFDataset.Node objectNode = quad.getObject(); String object = objectNode.getValue(); String lang = objectNode.getLanguage(); String type = objectNode.getDatatype(); if (objectNode.isLiteral()) { tripleType = ILoadSerialization.LITERAL; } else {
for (final RDFDataset.Quad quad : quads) { String subject = quad.getSubject().getValue(); String predicate = quad.getPredicate().getValue(); RDFDataset.Node objectNode = quad.getObject(); String object = objectNode.getValue(); String lang = objectNode.getLanguage(); String type = objectNode.getDatatype(); if (objectNode.isLiteral()) { tripleType = ILoadSerialization.LITERAL; } else {
@Override public int compareTo(Node o) { if (o == null) { // valid nodes are > null nodes return 1; } if (this.isIRI()) { if (!o.isIRI()) { // IRIs > everything return 1; } } else if (this.isBlankNode()) { if (o.isIRI()) { // IRI > blank node return -1; } else if (o.isLiteral()) { // blank node > literal return 1; } } else if (this.isLiteral()) { if (o.isIRI() || o.isBlankNode()) { return -1; // literals < blanknode < IRI } } // NOTE: Literal will also need to compare // language and datatype return this.getValue().compareTo(o.getValue()); }
@Override public int compareTo(Node o) { if (o == null) { // valid nodes are > null nodes return 1; } if (o.isIRI()) { // literals < iri return -1; } if (o.isBlankNode()) { // blank node < iri return -1; } if (this.getLanguage() == null && ((Literal) o).getLanguage() != null) { return -1; } else if (this.getLanguage() != null && ((Literal) o).getLanguage() == null) { return 1; } if (this.getDatatype() != null) { return this.getDatatype().compareTo(((Literal) o).getDatatype()); } else if (((Literal) o).getDatatype() != null) { return -1; } return 0; } }
@Override public int compareTo(Node o) { if (o == null) { // valid nodes are > null nodes return 1; } if (this.isIRI()) { if (!o.isIRI()) { // IRIs > everything return 1; } } else if (this.isBlankNode()) { if (o.isIRI()) { // IRI > blank node return -1; } else if (o.isLiteral()) { // blank node > literal return 1; } } else if (this.isLiteral()) { if (o.isIRI() || o.isBlankNode()) { return -1; // literals < blanknode < IRI } } // NOTE: Literal will also need to compare // language and datatype return this.getValue().compareTo(o.getValue()); }
@Override public int compareTo(Quad o) { if (o == null) { return 1; } int rval = getGraph().compareTo(o.getGraph()); if (rval != 0) { return rval; } rval = getSubject().compareTo(o.getSubject()); if (rval != 0) { return rval; } rval = getPredicate().compareTo(o.getPredicate()); if (rval != 0) { return rval; } return getObject().compareTo(o.getObject()); } }