示例#1
0
		public override bool Distinct { get { return false; } } // not sure...
		
		public override void Select(SelectFilter filter, SelectableSource targetModel, StatementSink sink) {
			if (filter.Subjects == null) filter.Subjects = new Entity[] { new Variable("subject") };
			if (filter.Predicates == null) filter.Predicates = new Entity[] { new Variable("predicate") };
			if (filter.Objects == null) filter.Objects = new Entity[] { new Variable("object") };

			if (filter.Metas == null) filter.Metas = new Entity[] { Statement.DefaultMeta };
			
			foreach (Statement s in filter) { // until we can operate on filter directly
				ArrayList evidence = prove(rules, targetModel, new Statement[] { s }, -1);
				if (evidence == null)
					continue; // not provable (in max number of steps, if that were given)
				
				foreach (EvidenceItem ei in evidence) {
					foreach (Statement h in ei.head) { // better be just one statement
						if (filter.LiteralFilters != null
							&& !LiteralFilter.MatchesFilters(h.Object, filter.LiteralFilters, targetModel))
							continue;
						
						sink.Add(h);
					}
				}
			}
		}
		public void Select(SelectFilter filter, StatementSink sink) {
			Select(filter.Subjects, filter.Predicates, filter.Objects, filter.Metas, filter.LiteralFilters, filter.Limit, sink, false);
		}
示例#3
0
		public abstract void Select(SelectFilter filter, SelectableSource targetModel, StatementSink sink);
示例#4
0
        /// <summary>
        /// Selects Statements from the Source based on a Filter
        /// </summary>
        /// <param name="filter">Statement Filter</param>
        /// <param name="sink">Sink to stream results to</param>
        public void Select(SelectFilter filter, StatementSink sink)
        {
            IEnumerable<Triple> ts = Enumerable.Empty<Triple>();
            if (filter.Metas != null)
            {
                //This applies over some Graphs
                foreach (Entity meta in filter.Metas)
                {
                    if (meta.Uri != null)
                    {
                        Uri graphUri = new Uri(meta.Uri);
                        if (this._store.HasGraph(graphUri))
                        {
                            ts = ts.Concat(this.FilterToEnumerable(filter, this._store.Graph(graphUri)));
                        }
                    }
                }
            }
            else
            {
                //This applies over all Graphs
                foreach (IGraph g in this._store.Graphs)
                {
                    ts = ts.Concat(this.FilterToEnumerable(filter, g));
                }
            }

            int count = 0;
            foreach (Triple t in ts)
            {
                //Apply limit if applicable
                if (filter.Limit > 0 && count >= filter.Limit) return;

                Statement stmt = SemWebConverter.ToSemWeb(t, this.GetMapping(t.Graph));
                stmt.Meta = new Entity(t.GraphUri.ToString());

                if (filter.LiteralFilters != null)
                {
                    if (LiteralFilter.MatchesFilters(stmt.Object, filter.LiteralFilters, this))
                    {
                        //If the Object matched the filters then we return the Triple and stop
                        //streaming if the sink tells us to
                        if (!sink.Add(stmt)) return;
                        count++;
                    }
                }
                else
                {
                    //Just add the statement and stop if the sink tells us to stop streaming
                    if (!sink.Add(stmt)) return;
                    count++;
                }
            }
        }
 public static Statement? SelectSingle(this SelectableSource src, SelectFilter filter)
 {
     var sink = new FirstStatementSink();
     src.Select(filter, sink);
     return sink.First;
 }
 public static IList<Statement> SelectList(this SelectableSource src, SelectFilter filter, bool distinct)
 {
     return SelectList(src, filter, distinct, Int32.MaxValue);
 }
 /// <summary>
 /// Selects Statements that match a given Filter
 /// </summary>
 /// <param name="filter">Filter</param>
 /// <param name="sink">Sink</param>
 /// <remarks>
 /// Currently not implemented
 /// </remarks>
 public void Select(SelectFilter filter, StatementSink sink)
 {
     //Implement as a SPARQL SELECT which UNIONS over all the possibles
     throw new NotImplementedException();
 }
示例#8
0
            private java.util.Iterator GetIterator(Entity[] subjects, Entity[] predicates, Resource[] objects, Entity[] metas, object[] litFilters, int limit)
            {
                if (subjects == null && predicates == null && objects == null && limit == -1)
                    throw new QueryExecutionException("Query would select all statements in the store!");

                if (subjects != null) Depersist(subjects);
                if (predicates != null) Depersist(predicates);
                if (objects != null) Depersist(objects);
                if (metas != null) Depersist(metas);

                if (subjects != null && subjects.Length == 0) return new EmptyIterator();
                if (predicates != null && predicates.Length == 0) return new EmptyIterator();
                if (objects != null && objects.Length == 0) return new EmptyIterator();
                if (metas != null && metas.Length == 0) return new EmptyIterator();

                SelectFilter filter = new SelectFilter(subjects, predicates, objects, metas);
                if (litFilters != null) {
                    filter.LiteralFilters = new LiteralFilter[litFilters.Length];
                    for (int i = 0; i < litFilters.Length; i++)
                        filter.LiteralFilters[i] = (LiteralFilter)litFilters[i];
                }
                if (limit == 0)
                    filter.Limit = 1;
                else if (limit > 0)
                    filter.Limit = limit;

                return new StatementIterator(source, filter, this);
            }
        public void InteropSemWebGraphSource()
        {
            Graph g = new Graph();
            //FileLoader.Load(g, "InferenceTest.ttl");
            GraphSource source = new GraphSource(g);

            Console.WriteLine("Reading the input using SemWeb");
            N3Reader reader = new N3Reader("InferenceTest.ttl");
            reader.Select(source);
            Console.WriteLine();

            Console.WriteLine("Outputting all Triples using N3Writer");
            N3Writer writer = new N3Writer(Console.Out);
            source.Select(writer);
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("Outputting all Triples of the form ?s rdf:type ?type");
            Statement template = new Statement(new Variable(), new Entity(RdfSpecsHelper.RdfType), new Variable());
            source.Select(template, writer);
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("Outputting all Triples of the form ?s rdf:type ?car");
            template = new Statement(new Variable(), new Entity(RdfSpecsHelper.RdfType), new Entity("http://example.org/vehicles/Car"));
            source.Select(template, writer);
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("Outputting all Triples for Cars and Planes");
            SelectFilter filter = new SelectFilter();
            filter.Predicates = new Entity[] { new Entity(RdfSpecsHelper.RdfType) };
            filter.Objects = new Entity[] { new Entity("http://example.org/vehicles/Car"), new Entity("http://example.org/vehicles/Plane") };
            source.Select(filter, writer);
            Console.WriteLine();
            Console.WriteLine();

            writer.Close();
        }
        public void InteropSemWebInMemoryStoreSource()
        {
            MicrosoftSqlStoreManager mssql = new MicrosoftSqlStoreManager("dotnetrdf_experimental", "sa", "20sQl08");
            InMemoryStoreSource source = new InMemoryStoreSource(new SqlTripleStore(mssql));

            N3Writer writer = new N3Writer(Console.Out);

            Console.WriteLine("Outputting all Triples of the form ?s rdf:type ?type");
            Statement template = new Statement(new Variable(), new Entity(RdfSpecsHelper.RdfType), new Variable());
            source.Select(template, writer);
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("Outputting all Triples of the form ?s rdf:type ?car");
            template = new Statement(new Variable(), new Entity(RdfSpecsHelper.RdfType), new Entity("http://example.org/vehicles/Car"));
            source.Select(template, writer);
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("Outputting all Triples for Cars and Planes");
            SelectFilter filter = new SelectFilter();
            filter.Predicates = new Entity[] { new Entity(RdfSpecsHelper.RdfType) };
            filter.Objects = new Entity[] { new Entity("http://example.org/vehicles/Car"), new Entity("http://example.org/vehicles/Plane") };
            source.Select(filter, writer);
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("Outputting the Speeds of all Cards");
            Variable car = new Variable("car");
            Statement[] pattern = new Statement[] 
            {
                new Statement(car, new Entity(RdfSpecsHelper.RdfType), new Entity("http://example.org/vehicles/Car")),
                new Statement(car, new Entity("http://example.org/vehicles/Speed"), new Variable("speed"))
            };
            source.Query(pattern, new QueryOptions(), new SemWebResultsConsolePrinter());
            Console.WriteLine();

            writer.Close();
        }
示例#11
0
 public SelectResult Select(SelectFilter filter)
 {
     return(new SelectResult.Multi(this, filter));
 }
示例#12
0
 public abstract void Select(SelectFilter filter, StatementSink result);
			public StatementIterator(SelectFilter filter) {
				f = filter;
				p = new SemWeb.Util.Permutation(new int[] {
					f.Subjects == null ? 1 : f.Subjects.Length,
					f.Predicates == null ? 1 : f.Predicates.Length,
					f.Objects == null ? 1 : f.Objects.Length,
					f.Metas == null ? 1 : f.Metas.Length,
					} );
			}
		public static SelectFilter[] FromGraph(Statement[] graph) {
			SelectFilter[] ret = new SelectFilter[graph.Length];
			for (int i = 0; i < ret.Length; i++)
				ret[i] = new SelectFilter(graph[i]);
			return ret;
		}
		public override void Select(SelectFilter filter, StatementSink result) {
			ResSet
				s = filter.Subjects == null ? null : new ResSet(filter.Subjects),
				p = filter.Predicates == null ? null : new ResSet(filter.Predicates),
				o = filter.Objects == null ? null : new ResSet(filter.Objects),
				m = filter.Metas == null ? null : new ResSet(filter.Metas);
				
			foreach (Statement st in statements) {
				if (s != null && !s.Contains(st.Subject)) continue;
				if (p != null && !p.Contains(st.Predicate)) continue;
				if (o != null && !o.Contains(st.Object)) continue;
				if (m != null && !m.Contains(st.Meta)) continue;
				if (filter.LiteralFilters != null && !LiteralFilter.MatchesFilters(st.Object, filter.LiteralFilters, this)) continue;
				if (!result.Add(st)) return;
			}
		}
示例#16
0
		public void Select(SelectFilter filter, StatementSink sink) {
			a.Select(filter, new Tester(b, sink));
		}
示例#17
0
			private StatementIterator GetIterator(Entity[] subjects, Entity[] predicates, Resource[] objects, Entity[] metas, java.util.List litFilters, bool defaultGraph) {
				DateTime start = DateTime.Now;

				if (subjects == null && predicates == null && objects == null)
					throw new QueryExecutionException("Query would select all statements in the store.");
				
				if (subjects != null) Depersist(subjects);
				if (predicates != null) Depersist(predicates);
				if (objects != null) Depersist(objects);
				if (metas != null) Depersist(metas);
				
				if (subjects != null && subjects.Length == 0) return new StatementIterator(null);
				if (predicates != null && predicates.Length == 0) return new StatementIterator(null);
				if (objects != null && objects.Length == 0) return new StatementIterator(null);
				if (metas != null && metas.Length == 0) return new StatementIterator(null);
				
				MemoryStore results = new MemoryStore();
				StatementSink sink = results;
				
				if (!source.Distinct)
					sink = new SemWeb.Util.DistinctStatementsSink(results, defaultGraph && metas == null);

				SelectFilter filter = new SelectFilter(subjects, predicates, objects, metas);
				if (litFilters != null) {
					filter.LiteralFilters = new LiteralFilter[litFilters.size()];
					for (int i = 0; i < litFilters.size(); i++)
						filter.LiteralFilters[i] = (LiteralFilter)litFilters.get(i);
				}

				source.Select(filter, sink);
				
				Log("SELECT: " + filter + " => " + results.StatementCount + " statements [" + (DateTime.Now-start) + "s]");
				
				return new StatementIterator(results.ToArray());
			}
示例#18
0
		public void Select(SelectFilter filter, StatementSink sink) {
			if (filter.Predicates == null || filter.LiteralFilters != null) {
				data.Select(filter, sink);
				return;
			}
			
			ResSet remainingPredicates = new ResSet();
			
			Entity[] subjects = filter.Subjects;
			Entity[] predicates = filter.Predicates;
			Resource[] objects = filter.Objects;
			Entity[] metas = filter.Metas;
			
			foreach (Entity p in predicates) {
				if (p == type) {
					if (objects != null) {
						// Do the subjects have any of the types listed in the objects,
						// or what things have those types?
						
						// Expand objects by the subclass closure of the objects
						data.Select(new SelectFilter(subjects, new Entity[] { p }, GetClosure(objects, subclasses), metas), sink);
						
						// Process domains and ranges.
						ResSet dom = new ResSet(), ran = new ResSet();
						Hashtable domPropToType = new Hashtable();
						Hashtable ranPropToType = new Hashtable();
						foreach (Entity e in objects) {
							Entity[] dc = GetClosure((ResSet)domainof[e], subprops);
							if (dc != null)
							foreach (Entity c in dc) {
								dom.Add(c);
								AddRelation(c, e, domPropToType, false);
							}
							
							dc = GetClosure((ResSet)rangeof[e], subprops);
							if (dc != null)
							foreach (Entity c in dc) {
								ran.Add(c);
								AddRelation(c, e, ranPropToType, false);
							}
						}
						
						// If it's in the domain of any of these properties,
						// we know its type.
						if (subjects != null) {
							if (dom.Count > 0) data.Select(new SelectFilter(subjects, dom.ToEntityArray(), null, metas), new ExpandDomRan(0, domPropToType, sink));
							if (ran.Count > 0) data.Select(new SelectFilter(null, ran.ToEntityArray(), subjects, metas), new ExpandDomRan(1, ranPropToType, sink));
						}
						
					} else if (subjects != null) {
						// What types do these subjects have?
						
						// Expand the resulting types by the closure of their superclasses
						data.Select(new SelectFilter(subjects, new Entity[] { p }, objects, metas), new Expand(superclasses, sink));
						
						// Use domains and ranges to get type info
						data.Select(new SelectFilter(subjects, null, null, metas), new Expand3(0, domains, superclasses, sink));
						data.Select(new SelectFilter(null, null, subjects, metas), new Expand3(1, ranges, superclasses, sink));

					} else {
						// What has type what?  We won't answer that question.
						data.Select(filter, sink);
					}

				} else if ((p == subClassOf || p == subPropertyOf)
					&& (metas == null || metas[0] == Statement.DefaultMeta)) {
					
					Hashtable supers = (p == subClassOf) ? superclasses : superprops;
					Hashtable subs = (p == subClassOf) ? subclasses : subprops;
					
					if (subjects != null && objects != null) {
						// Expand objects by the subs closure of the objects.
						data.Select(new SelectFilter(subjects, new Entity[] { p }, GetClosure(objects, subs), metas), sink);
					} else if (subjects != null) {
						// get all of the supers of all of the subjects
						foreach (Entity s in subjects)
							foreach (Entity o in GetClosure(new Entity[] { s }, supers))
								sink.Add(new Statement(s, p, o));
					} else if (objects != null) {
						// get all of the subs of all of the objects
						foreach (Resource o in objects) {
							if (o is Literal) continue;
							foreach (Entity s in GetClosure(new Entity[] { (Entity)o }, subs))
								sink.Add(new Statement(s, p, (Entity)o));
						}
					} else {
						// What is a subclass/property of what?  We won't answer that.
						data.Select(filter, sink);
					}
				} else {
					remainingPredicates.Add(p);
				}
			}
			
			if (remainingPredicates.Count > 0) {
				// Also query the subproperties of any property
				// being queried, but remember which subproperties
				// came from which superproperties so we can map them
				// back to the properties actually queried.  The closures
				// contain the queried properties themselves too.
				ResSet qprops = new ResSet();
				Hashtable propfrom = new Hashtable();
				foreach (Entity p in remainingPredicates) { 
					foreach (Entity sp in GetClosure(new Entity[] { p }, subprops)) {
						AddRelation(sp, p, propfrom, false);
						qprops.Add(sp);
					}
				}
				
				//data.Select(subjects, qprops.ToEntityArray(), objects, metas, new LiteralDTMap(ranges, new PredMap(propfrom, sink)));
				
				SelectFilter sf = new SelectFilter(subjects, qprops.ToEntityArray(), objects, metas);
				sf.LiteralFilters = filter.LiteralFilters;
				sf.Limit = filter.Limit;
				
				data.Select(sf, new PredMap(propfrom, sink));
			}
		}
示例#19
0
 public StatementIterator(SelectableSource source, SelectFilter filter, RdfSourceWrapper wrapper)
 {
     this.source = source;
     this.filter = filter;
     this.wrapper = wrapper;
     this.wantMetas = true;
 }
示例#20
0
        /// <summary>
        /// Selects Statements from the Source based on a Filter
        /// </summary>
        /// <param name="filter">Statement Filter</param>
        /// <param name="sink">Sink to stream results to</param>
        public void Select(SelectFilter filter, StatementSink sink)
        {
            //Don't support filters on Metas for the Graph Source
            if (filter.Metas != null)
            {
                throw new RdfException("The dotNetRDF GraphSource does not support SemWeb filters which use Meta filters");
            }

            //Want to build an IEnumerable based on the Filter
            IEnumerable<Triple> ts = Enumerable.Empty<Triple>();
            INode s, p, o;

            if (filter.Subjects != null)
            {
                if (filter.Predicates != null)
                {
                    //Subject-Predicate filter
                    foreach (Entity subj in filter.Subjects)
                    {
                        s = SemWebConverter.FromSemWeb(subj, this._mapping);
                        foreach (Entity pred in filter.Predicates)
                        {
                            p = SemWebConverter.FromSemWeb(pred, this._mapping);
                            ts = ts.Concat(this._g.GetTriplesWithSubjectPredicate(s, p));
                        }
                    }
                }
                else if (filter.Objects != null)
                {
                    //Subject-Object filter
                    foreach (Entity subj in filter.Subjects)
                    {
                        s = SemWebConverter.FromSemWeb(subj, this._mapping);
                        foreach (Resource obj in filter.Objects)
                        {
                            o = SemWebConverter.FromSemWeb(obj, this._mapping);
                            ts = ts.Concat(this._g.GetTriplesWithSubjectObject(s, o));
                        }
                    }
                }
                else
                {
                    //Subjects filter
                    foreach (Entity subj in filter.Subjects)
                    {
                        s = SemWebConverter.FromSemWeb(subj, this._mapping);
                        ts = ts.Concat(this._g.GetTriplesWithSubject(s));
                    }
                }
            }
            else if (filter.Predicates != null)
            {
                if (filter.Objects != null)
                {
                    //Predicate-Object Filter
                    foreach (Entity pred in filter.Predicates)
                    {
                        p = SemWebConverter.FromSemWeb(pred, this._mapping);
                        foreach (Resource obj in filter.Objects)
                        {
                            o = SemWebConverter.FromSemWeb(obj, this._mapping);
                            ts = ts.Concat(this._g.GetTriplesWithPredicateObject(p,o));
                        }
                    }
                }
                else
                {
                    //Predicate Filter
                    foreach (Entity pred in filter.Predicates)
                    {
                        p = SemWebConverter.FromSemWeb(pred, this._mapping);
                        ts = ts.Concat(this._g.GetTriplesWithPredicate(p));
                    }
                }
            }
            else if (filter.Objects != null)
            {
                //Object Filter
                foreach (Resource obj in filter.Objects)
                {
                    o = SemWebConverter.FromSemWeb(obj, this._mapping);
                    ts = ts.Concat(this._g.GetTriplesWithObject(o));
                }
            }
            else
            {
                //Everything is null so this is a Select All
                ts = this._g.Triples;
            }

            int count = 0;
            foreach (Triple t in ts) 
            {
                //Apply limit if applicable
                if (filter.Limit > 0 && count >= filter.Limit) return;

                //Convert to a Statement and apply applicable Literal Filters
                Statement stmt = SemWebConverter.ToSemWeb(t, this._mapping);
                if (filter.LiteralFilters != null)
                {
                    if (LiteralFilter.MatchesFilters(stmt.Object, filter.LiteralFilters, this))
                    {
                        //If the Object matched the filters then we return the Triple and stop
                        //streaming if the sink tells us to
                        if (!sink.Add(stmt)) return;
                        count++;
                    }
                    //If it doesn't match the filter it is ignored
                }
                else
                {
                    //Just add the statement and stop if the sink tells us to stop streaming
                    if (!sink.Add(stmt)) return;
                    count++;
                }
            }
        }
 public static IList<Statement> SelectList(this SelectableSource src, SelectFilter filter)
 {
     return SelectList(src, filter, false);
 }
示例#22
0
		public static bool DefaultContains(SelectableSource source, Statement template) {
			StatementExistsSink sink = new StatementExistsSink();
			SelectFilter filter = new SelectFilter(template);
			filter.Limit = 1;
			source.Select(filter, sink);
			return sink.Exists;
		}
 public static IList<Statement> SelectList(this SelectableSource src, SelectFilter filter, bool distinct, int maxStatements)
 {
     var sink = new StatementListSink(distinct,maxStatements);
     src.Select(filter, sink);
     return sink.List;
 }
示例#24
0
		public static void DefaultSelect(SelectableSource source, SelectFilter filter, StatementSink sink) {
			// This method should be avoided...
			if (filter.LiteralFilters != null)
				sink = new SemWeb.Filters.FilterSink(filter.LiteralFilters, sink, source);
			foreach (Entity subject in filter.Subjects == null ? new Entity[] { null } : filter.Subjects)
			foreach (Entity predicate in filter.Predicates == null ? new Entity[] { null } : filter.Predicates)
			foreach (Resource objct in filter.Objects == null ? new Resource[] { null } : filter.Objects)
			foreach (Entity meta in filter.Metas == null ? new Entity[] { null } : filter.Metas)
				source.Select(new Statement(subject, predicate, objct, meta), sink);
		}		
示例#25
0
	public void Select (SelectFilter filter, StatementSink sink)
	{
		throw new NotImplementedException ("Select");
		// FIXME: not implemented yet, SelectFilter are a little more complex
		// than Statements with wildcards
	}
示例#26
0
		public abstract void Select(SelectFilter filter, StatementSink result);
示例#27
0
        private IEnumerable<Triple> FilterToEnumerable(SelectFilter filter, IGraph g)
        {
            //Want to build an IEnumerable based on the Filter
            IEnumerable<Triple> ts = Enumerable.Empty<Triple>();
            INode s, p, o;
            int hash = (g.BaseUri == null) ? new Uri(GraphCollection.DefaultGraphUri).GetEnhancedHashCode() : g.BaseUri.GetEnhancedHashCode();

            if (filter.Subjects != null)
            {
                if (filter.Predicates != null)
                {
                    //Subject-Predicate filter
                    foreach (Entity subj in filter.Subjects)
                    {
                        s = SemWebConverter.FromSemWeb(subj, this.GetMapping(hash, g));
                        foreach (Entity pred in filter.Predicates)
                        {
                            p = SemWebConverter.FromSemWeb(pred, this.GetMapping(hash, g));
                            ts = ts.Concat(g.GetTriplesWithSubjectPredicate(s, p));
                        }
                    }
                }
                else if (filter.Objects != null)
                {
                    //Subject-Object filter
                    foreach (Entity subj in filter.Subjects)
                    {
                        s = SemWebConverter.FromSemWeb(subj, this.GetMapping(hash, g));
                        foreach (Resource obj in filter.Objects)
                        {
                            o = SemWebConverter.FromSemWeb(obj, this.GetMapping(hash, g));
                            ts = ts.Concat(g.GetTriplesWithSubjectObject(s, o));
                        }
                    }
                }
                else
                {
                    //Subjects filter
                    foreach (Entity subj in filter.Subjects)
                    {
                        s = SemWebConverter.FromSemWeb(subj, this.GetMapping(hash, g));
                        ts = ts.Concat(g.GetTriplesWithSubject(s));
                    }
                }
            }
            else if (filter.Predicates != null)
            {
                if (filter.Objects != null)
                {
                    //Predicate-Object Filter
                    foreach (Entity pred in filter.Predicates)
                    {
                        p = SemWebConverter.FromSemWeb(pred, this.GetMapping(hash, g));
                        foreach (Resource obj in filter.Objects)
                        {
                            o = SemWebConverter.FromSemWeb(obj, this.GetMapping(hash, g));
                            ts = ts.Concat(g.GetTriplesWithPredicateObject(p, o));
                        }
                    }
                }
                else
                {
                    //Predicate Filter
                    foreach (Entity pred in filter.Predicates)
                    {
                        p = SemWebConverter.FromSemWeb(pred, this.GetMapping(hash, g));
                        ts = ts.Concat(g.GetTriplesWithPredicate(p));
                    }
                }
            }
            else if (filter.Objects != null)
            {
                //Object Filter
                foreach (Resource obj in filter.Objects)
                {
                    o = SemWebConverter.FromSemWeb(obj, this.GetMapping(hash, g));
                    ts = ts.Concat(g.GetTriplesWithObject(o));
                }
            }
            else
            {
                //Everything is null so this is a Select All
                ts = g.Triples;
            }

            return ts;
        }
示例#28
0
		public SelectResult Select(SelectFilter filter) {
			return new SelectResult.Multi(this, filter);
		}
示例#29
0
		public override void Select(SelectFilter filter, SelectableSource targetModel, StatementSink sink) {
			targetModel.Select(filter, sink);
		}
示例#30
0
			SelectFilter filter;
			public Multi(Store source, SelectFilter filter)
				: base(source) {
				this.filter = filter;