use of org.apache.jena.sparql.core.Quad in project jena by apache.
the class QuadWritable method readFields.
@Override
public void readFields(DataInput input) throws IOException {
this.quad.clear();
int tripleLength = input.readInt();
byte[] buffer = new byte[tripleLength];
input.readFully(buffer);
try {
ThriftConverter.fromBytes(buffer, this.quad);
} catch (TException e) {
throw new IOException(e);
}
this.setInternal(new Quad(ThriftConvert.convert(this.quad.getG()), ThriftConvert.convert(this.quad.getS()), ThriftConvert.convert(this.quad.getP()), ThriftConvert.convert(this.quad.getO())));
}
use of org.apache.jena.sparql.core.Quad in project jena by apache.
the class FusekiLib method addDataInto.
public static void addDataInto(DatasetGraph src, DatasetGraph dest) {
Iterator<Quad> iter = src.find(Node.ANY, Node.ANY, Node.ANY, Node.ANY);
for (; iter.hasNext(); ) {
Quad q = iter.next();
dest.add(q);
}
PrefixMapping pmapSrc = src.getDefaultGraph().getPrefixMapping();
PrefixMapping pmapDest = dest.getDefaultGraph().getPrefixMapping();
pmapDest.withDefaultMappings(pmapSrc);
}
use of org.apache.jena.sparql.core.Quad in project jena by apache.
the class Template method equalIso.
public boolean equalIso(Object temp2, NodeIsomorphismMap labelMap) {
if (!(temp2 instanceof Template))
return false;
Template tg2 = (Template) temp2;
List<Quad> list1 = this.getQuads();
List<Quad> list2 = tg2.getQuads();
if (list1.size() != list2.size())
return false;
for (int i = 0; i < list1.size(); i++) {
Quad q1 = list1.get(i);
Quad q2 = list2.get(i);
boolean iso = Iso.quadIso(q1, q2, labelMap);
if (!iso) {
return false;
}
}
return true;
}
use of org.apache.jena.sparql.core.Quad in project jena by apache.
the class BuilderGraph method buildDataset.
public static DatasetGraph buildDataset(DatasetGraph dsg, ItemList list) {
BuilderLib.checkTag(list, Tags.tagDataset);
list = list.cdr();
for (Item item : list) {
if (!item.isTagged(Tags.tagGraph)) {
// Not (graph ...) so it's (quad), short form quad or an error.
Quad q = BuilderGraph.buildQuad(item.getList(), "Expected (graph ...) or a quad () as elements of a dataset");
dsg.add(q);
continue;
}
Node name = null;
ItemList graphContent = item.getList().cdr();
if (!graphContent.isEmpty() && graphContent.car().isNode()) {
name = graphContent.car().getNode();
graphContent = graphContent.cdr();
}
Graph g;
if (name == null) {
g = dsg.getDefaultGraph();
if (g == null) {
g = GraphFactory.createDefaultGraph();
dsg.setDefaultGraph(g);
}
} else {
g = dsg.getGraph(name);
if (g == null) {
g = GraphFactory.createDefaultGraph();
dsg.addGraph(name, g);
}
}
BuilderGraph.buildGraph(g, graphContent);
}
return dsg;
}
use of org.apache.jena.sparql.core.Quad in project jena by apache.
the class BuilderGraph method _buildNode4.
private static Quad _buildNode4(ItemList list) {
Node g = null;
if (list.get(0).equals(Item.defaultItem))
g = Quad.defaultGraphNodeGenerated;
else
g = BuilderNode.buildNode(list.get(0));
Node s = BuilderNode.buildNode(list.get(1));
Node p = BuilderNode.buildNode(list.get(2));
Node o = BuilderNode.buildNode(list.get(3));
return new Quad(g, s, p, o);
}
Aggregations