private void addTripleToDataset(RDFDataset dataset, RDFDataset.Node subject, RDFDataset.Node predicate, RDFDataset.Node object){ String name = "@default"; RDFDataset.Quad triple = new RDFDataset.Quad(subject, predicate, object, name); // initialise graph in dataset if (!dataset.containsKey(name)) { final List<RDFDataset.Quad> tmp = new ArrayList<RDFDataset.Quad>(); tmp.add(triple); dataset.put(name, tmp); } // add triple if unique to its graph else { final List<RDFDataset.Quad> triples = (List<RDFDataset.Quad>) dataset.get(name); if (!triples.contains(triple)) { triples.add(triple); } } }
private void addTypeTripleToDataset(RDFDataset dataset, String id, String type) { String name = "@default"; RDFDataset.Quad triple = new RDFDataset.Quad(id, JsonLdConsts.RDF_TYPE, type, name); // initialise graph in dataset if (!dataset.containsKey(name)) { final List<RDFDataset.Quad> tmp = new ArrayList<RDFDataset.Quad>(); tmp.add(triple); dataset.put(name, tmp); } // add triple if unique to its graph else { final List<RDFDataset.Quad> triples = (List<RDFDataset.Quad>) dataset.get(name); if (!triples.contains(triple)) { triples.add(triple); } } } }
/** * Adds a triple to the specified graph of this dataset * * @param subject * the subject for the triple * @param predicate * the predicate for the triple * @param object * the object for the triple * @param graph * the graph to add this triple to */ public void addQuad(final String subject, final String predicate, final String object, String graph) { if (graph == null) { graph = "@default"; } if (!containsKey(graph)) { put(graph, new ArrayList<Quad>()); } ((ArrayList<Quad>) get(graph)).add(new Quad(subject, predicate, object, graph)); }
/** * Adds a triple to the specified graph of this dataset * * @param subject * the subject for the triple * @param predicate * the predicate for the triple * @param object * the object for the triple * @param graph * the graph to add this triple to */ public void addQuad(final String subject, final String predicate, final String object, String graph) { if (graph == null) { graph = "@default"; } if (!containsKey(graph)) { put(graph, new ArrayList<Quad>()); } ((ArrayList<Quad>) get(graph)).add(new Quad(subject, predicate, object, graph)); }
/** * Adds a triple to the specified graph of this dataset * * @param subject * the subject for the triple * @param predicate * the predicate for the triple * @param object * the object for the triple * @param graph * the graph to add this triple to */ public void addQuad(final String subject, final String predicate, final String object, String graph) { if (graph == null) { graph = "@default"; } if (!containsKey(graph)) { put(graph, new ArrayList<Quad>()); } ((ArrayList<Quad>) get(graph)).add(new Quad(subject, predicate, object, graph)); }
/** * Adds a triple to the specified graph of this dataset * * @param s * the subject for the triple * @param p * the predicate for the triple * @param value * the value of the literal object for the triple * @param datatype * the datatype of the literal object for the triple (null values * will default to xsd:string) * @param graph * the graph to add this triple to * @param language * the language of the literal object for the triple (or null) */ public void addQuad(final String s, final String p, final String value, final String datatype, final String language, String graph) { if (graph == null) { graph = "@default"; } if (!containsKey(graph)) { put(graph, new ArrayList<Quad>()); } ((ArrayList<Quad>) get(graph)).add(new Quad(s, p, value, datatype, language, graph)); }
/** * Adds a triple to the specified graph of this dataset * * @param s * the subject for the triple * @param p * the predicate for the triple * @param value * the value of the literal object for the triple * @param datatype * the datatype of the literal object for the triple (null values * will default to xsd:string) * @param graph * the graph to add this triple to * @param language * the language of the literal object for the triple (or null) */ public void addQuad(final String s, final String p, final String value, final String datatype, final String language, String graph) { if (graph == null) { graph = "@default"; } if (!containsKey(graph)) { put(graph, new ArrayList<Quad>()); } ((ArrayList<Quad>) get(graph)).add(new Quad(s, p, value, datatype, language, graph)); }
/** * Adds a triple to the specified graph of this dataset * * @param s * the subject for the triple * @param p * the predicate for the triple * @param value * the value of the literal object for the triple * @param datatype * the datatype of the literal object for the triple (null values * will default to xsd:string) * @param graph * the graph to add this triple to * @param language * the language of the literal object for the triple (or null) */ public void addQuad(final String s, final String p, final String value, final String datatype, final String language, String graph) { if (graph == null) { graph = "@default"; } if (!containsKey(graph)) { put(graph, new ArrayList<Quad>()); } ((ArrayList<Quad>) get(graph)).add(new Quad(s, p, value, datatype, language, graph)); }
if (!dataset.containsKey(name)) { final List<RDFDataset.Quad> tmp = new ArrayList<RDFDataset.Quad>(); tmp.add(triple);
if (!dataset.containsKey(name)) { final List<RDFDataset.Quad> tmp = new ArrayList<>(); tmp.add(triple);
if (!dataset.containsKey(name)) { final List<RDFDataset.Quad> tmp = new ArrayList<RDFDataset.Quad>(); tmp.add(triple);