public org.openrdf.query.GraphQueryResult evaluate() { IGraph g = this.EvaluateQuery(); SesameMapping mapping = new SesameMapping(g, new dotSesame.impl.GraphImpl()); IEnumerable <dotSesame.Statement> stmts = from t in g.Triples select SesameConverter.ToSesame(t, mapping); DotNetEnumerableWrapper wrapper = new DotNetEnumerableWrapper(stmts); java.util.HashMap map = new java.util.HashMap(); foreach (String prefix in g.NamespaceMap.Prefixes) { map.put(prefix, g.NamespaceMap.GetNamespaceUri(prefix).ToString()); } dotSesameQuery.impl.GraphQueryResultImpl results = new org.openrdf.query.impl.GraphQueryResultImpl(map, wrapper); return(results); }
public void evaluate(org.openrdf.rio.RDFHandler rdfh) { IGraph g = this.EvaluateQuery(); SesameMapping mapping = new SesameMapping(g, new dotSesame.impl.GraphImpl()); rdfh.startRDF(); foreach (String prefix in g.NamespaceMap.Prefixes) { rdfh.handleNamespace(prefix, g.NamespaceMap.GetNamespaceUri(prefix).ToString()); } foreach (Triple t in g.Triples) { rdfh.handleStatement(SesameConverter.ToSesame(t, mapping)); } rdfh.endRDF(); }
public object[] toArray(object[] objarr) { if (objarr.Length < this._g.Triples.Count) { objarr = new object[this._g.Triples.Count]; } int i = 0; foreach (Triple t in this._g.Triples) { objarr[i] = SesameConverter.ToSesame(t, this._mapping); i++; } if (i < objarr.Length) { objarr[i] = null; } return(objarr); }
protected override void Delete(Triple t) { this._g.remove(SesameConverter.ToSesame(t, this._mapping)); }
public override bool Contains(Triple t) { return(this._g.contains(SesameConverter.ToSesame(t, this._mapping))); }
protected override void Add(Triple t) { this._g.add(SesameConverter.ToSesame(t, this._mapping)); }
public java.util.Iterator match(dotSesame.Resource r, dotSesame.URI uri, dotSesame.Value v, params dotSesame.Resource[] rarr) { INode s = (r != null) ? SesameConverter.FromSesameResource(r, this._mapping) : null; INode p = (uri != null) ? SesameConverter.FromSesameUri(uri, this._mapping) : null; INode o = (v != null) ? SesameConverter.FromSesameValue(v, this._mapping) : null; //Contexts are Ignored for matches on a single Graph IEnumerable <Triple> ts; if (s != null) { if (p != null) { if (o != null) { //Matching on Subject Predicate and Object Triple t = new Triple(s, p, o); if (this._g.ContainsTriple(t)) { ts = t.AsEnumerable(); } else { ts = Enumerable.Empty <Triple>(); } } else { //Just matching on Subject Predicate ts = this._g.GetTriplesWithSubjectPredicate(s, p); } } else { if (o != null) { //Matching on Subject Object ts = this._g.GetTriplesWithSubjectObject(s, o); } else { //Just Matching on Subject ts = this._g.GetTriplesWithSubject(s); } } } else if (p != null) { if (o != null) { //Matching on Predicate Object ts = this._g.GetTriplesWithPredicateObject(p, o); } else { //Just Matching on Predicate ts = this._g.GetTriplesWithPredicate(p); } } else if (o != null) { //Matching on Object only ts = this._g.GetTriplesWithObject(o); } else { //Matching anything ts = this._g.Triples; } return(new DotNetEnumerableWrapper(ts.Select(t => SesameConverter.ToSesame(t, this._mapping)))); }
public object[] toArray() { return(this._g.Triples.Select(t => SesameConverter.ToSesame(t, this._mapping)).ToArray()); }