/** * Adds RDF triples for each graph in the current node map to an RDF * dataset. * * @return the RDF dataset. * @throws JsonLdError * If there was an error converting from JSON-LD to RDF. */ public RDFDataset toRDF() throws JsonLdError { // TODO: make the default generateNodeMap call (i.e. without a // graphName) create and return the nodeMap final Map<String, Object> nodeMap = newMap(); nodeMap.put("@default", newMap()); generateNodeMap(this.value, nodeMap); final RDFDataset dataset = new RDFDataset(this); for (final Map.Entry<String, Object> stringObjectEntry : nodeMap.entrySet()) { // 4.1) if (JsonLdUtils.isRelativeIri(stringObjectEntry.getKey())) { continue; } final Map<String, Object> graph = (Map<String, Object>) stringObjectEntry.getValue(); replaceBlankNode(graph); dataset.graphToRDF(stringObjectEntry.getKey(), graph); } return dataset; }
/** * Adds RDF triples for each graph in the current node map to an RDF * dataset. * * @return the RDF dataset. * @throws JsonLdError * If there was an error converting from JSON-LD to RDF. */ public RDFDataset toRDF() throws JsonLdError { // TODO: make the default generateNodeMap call (i.e. without a // graphName) create and return the nodeMap final Map<String, Object> nodeMap = newMap(); nodeMap.put(JsonLdConsts.DEFAULT, newMap()); generateNodeMap(this.value, nodeMap); final RDFDataset dataset = new RDFDataset(this); for (final String graphName : nodeMap.keySet()) { // 4.1) if (JsonLdUtils.isRelativeIri(graphName)) { continue; } final Map<String, Object> graph = (Map<String, Object>) nodeMap.get(graphName); dataset.graphToRDF(graphName, graph); } return dataset; }
/** * Adds RDF triples for each graph in the current node map to an RDF * dataset. * * @return the RDF dataset. * @throws JsonLdError * If there was an error converting from JSON-LD to RDF. */ public RDFDataset toRDF() throws JsonLdError { // TODO: make the default generateNodeMap call (i.e. without a // graphName) create and return the nodeMap final Map<String, Object> nodeMap = newMap(); nodeMap.put(JsonLdConsts.DEFAULT, newMap()); generateNodeMap(this.value, nodeMap); final RDFDataset dataset = new RDFDataset(this); for (final String graphName : nodeMap.keySet()) { // 4.1) if (JsonLdUtils.isRelativeIri(graphName)) { continue; } final Map<String, Object> graph = (Map<String, Object>) nodeMap.get(graphName); dataset.graphToRDF(graphName, graph); } return dataset; }