JsonLdIRIImpl(final Node node) { super(node); if (!node.isIRI()) { throw new IllegalArgumentException("Node is not an IRI:" + node); } }
if (isIRI() || isBlankNode()) { return newMap("@id", getValue());
if (isIRI() || isBlankNode()) { return newMap("@id", getValue());
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()); if (object.isBlankNode() || object.isIRI()) {
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()); if (object.isBlankNode() || object.isIRI()) {
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()); if (object.isBlankNode() || object.isIRI()) {
if (isIRI() || isBlankNode()) { return newMap("@id", getValue());
@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()); }
JsonLdTerm asRDFTerm(final Node node, final String blankNodePrefix) { if (node == null) { return null; // e.g. default graph } if (node.isIRI()) { return new JsonLdIRIImpl(node); } else if (node.isBlankNode()) { return new JsonLdBlankNodeImpl(node, blankNodePrefix); } else if (node.isLiteral()) { // TODO: Our own JsonLdLiteral if (node.getLanguage() != null) { return createLiteral(node.getValue(), node.getLanguage()); } return createLiteral(node.getValue(), createIRI(node.getDatatype())); } else { throw new IllegalArgumentException("Node is neither IRI, BlankNode nor Literal: " + node); } }
@Override public int compareTo(Node o) { 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; } } return this.getValue().compareTo(o.getValue()); }
public static Node jsonld_java_Node__to__nxparser_Node( com.github.jsonldjava.core.RDFDataset.Node jsonldNode, Node graphName) { if (jsonldNode.isBlankNode()) { return BNode.createBNode(graphName.toString(), jsonldNode.getValue()); } else if (jsonldNode.isIRI()) { return new Resource(jsonldNode.getValue()); } else if (jsonldNode.isLiteral()) { return new Literal(jsonldNode.getValue(), jsonldNode.getLanguage(), jsonldNode.getLanguage() == null ? new Resource( jsonldNode.getDatatype()) : null); } _log.log(Level.WARNING, "Could not convert: {0}", new Object[] { jsonldNode }); return null; }