当前位置: 首页>>代码示例>>C#>>正文


C# StatementSink类代码示例

本文整理汇总了C#中StatementSink的典型用法代码示例。如果您正苦于以下问题:C# StatementSink类的具体用法?C# StatementSink怎么用?C# StatementSink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StatementSink类属于命名空间,在下文中一共展示了StatementSink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SemWebTripleCollection

 /// <summary>
 /// Creates a new Triple Collection as a wrapper around a SemWeb StatementSink and StatementSource
 /// </summary>
 /// <param name="g">Graph</param>
 /// <param name="sink">Sink</param>
 /// <param name="source">Source</param>
 public SemWebTripleCollection(IGraph g, StatementSink sink, StatementSource source) 
 {
     this._g = g;
     this._sink = sink;
     this._source = source;
     this._mapping = new SemWebMapping(this._g);
 }
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:13,代码来源:SemWebTripleCollection.cs

示例2: Select

	public void Select (Statement template, StatementSink sink)
	{
		// extract the fields for easy access
		Entity subj = template.Subject;
		Entity pred = template.Predicate;
		Resource obj = template.Object;

		// convert the SemWeb fields to the RDFQuery fields
		Uri s;
		string p, o;
		rdf_to_beagle_hook (subj, pred, obj, out s, out p, out o);

		RDFQuery query = new RDFQuery (s, p, o);
		RDFQueryResult result = (RDFQueryResult) query.Send ();
		
		foreach (Hit hit in result.Hits) {
			Entity subject = new Entity (hit.Uri.ToString ()); //FIXME: Do we have to use strings here?
			foreach (Property prop in hit.Properties) {
				Entity predicate = BeaglePropertyToEntity (prop.Type, prop.Key);
				Resource _object;
				property_to_rdf_hook (prop, out _object);
			
				// now create a the statement and add it to the result
				Statement st = new Statement (subject, predicate, _object);
				sink.Add (st);
			}
		}
	}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:28,代码来源:BeagleSource.cs

示例3: Select

		public override void Select(StatementSink storage) {
			// Read past the processing instructions to
			// the document element.  If it is rdf:RDF,
			// then process the description nodes within it.
			// Otherwise, the document element is itself a
			// description.
			
			this.storage = storage;
									
			while (xml.Read()) {
				if (xml.NamespaceURI == NS.RDF && xml.LocalName == "RDF" ) {
					// If there is an xml:base here, set BaseUri so
					// the application can recover it.  It doesn't
					// affect parsing since the xml:base attribute
					// will override BaseUri.
					string xmlbase = xml.GetAttribute("xml:base");
					if (xmlbase != null) BaseUri = xmlbase;
					
					while (xml.Read()) {
						if (xml.NodeType == XmlNodeType.Element)
							ParseDescription();
					}
					break;
				}
			}

			xml.Close();
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:28,代码来源:RdfXmlReader.cs

示例4: Select

		public void Select (StatementSink sink)
		{
			using (Stream stream = Open ()) {
				Header header = new Header (stream);
				MetadataStore.AddLiteral (sink, "tiff:ImageWidth", header.Width.ToString ());
				MetadataStore.AddLiteral (sink, "tiff:ImageLength", header.Height.ToString ());
				string bits = header.IsDeep ? "16" : "8";
				MetadataStore.Add (sink, "tiff:BitsPerSample", "rdf:Seq", new string [] { bits, bits, bits });
			}
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:10,代码来源:PnmFile.cs

示例5: Select

		bool Select(Entity[] subjects, Entity[] predicates, Resource[] objects, Entity[] metas, LiteralFilter[] litFilters, int limit, StatementSink sink, bool ask) {
			// TODO: Change meta into named graphs.  Anything but a null or DefaultMeta
			// meta returns no statements immediately.
			if (metas != null && (metas.Length != 1 || metas[0] != Statement.DefaultMeta))
				return false;
		
			string query;
			bool nonull = false;
		
			if (subjects != null && subjects.Length == 1
				&& predicates != null && predicates.Length == 1
				&& objects != null && objects.Length == 1) {
				query = "ASK WHERE { " + S(subjects[0], null) + " " + S(predicates[0], null) + " " + S(objects[0], null) + "}";
				nonull = true;
			} else {
				if (ask)
					query = "ASK { ";
				else
					query = "SELECT * WHERE { ";
				query += S(subjects, "?subject");
				query += " ";
				query += S(predicates, "?predicate");
				query += " ";
				query += S(objects, "?object");
				query += " . ";
				query += SL(subjects, "?subject", false);
				query += SL(predicates, "?predicate", false);
				query += SL(objects, "?object", false);
				query += " }";
				
				// TODO: Pass literal filters to server.
			}
			
			if (limit >= 1)
				query += " LIMIT " + limit;
				
			Statement d = new Statement(
				(subjects != null && subjects.Length == 1) ? subjects[0] : null,
				(predicates != null && predicates.Length == 1) ? predicates[0] : null,
				(objects != null && objects.Length == 1) ? objects[0] : null);
			
			if (ask || nonull) {
				BooleanWrap bw = new BooleanWrap();
				Load(query, bw);
				if (ask)
					return bw.value;
				else if (bw.value)
					sink.Add(new Statement(subjects[0], predicates[0], objects[0]));
				return false;
			} else {
				Load(query, new QueryToStatements(sink, litFilters, d));
				return true;
			}
		}
开发者ID:CTSIatUCSF,项目名称:ProfilesRNS10x-OpenSocial,代码行数:54,代码来源:SparqlClient.cs

示例6: Select

		public override void Select(StatementSink store) {
			ParseContext context = new ParseContext();
			context.source = new MyReader(sourcestream);
			context.store = GetDupCheckSink(store);
			context.namespaces = namespaces;
			context.namedNode = new UriMap();
			context.anonymous = new Hashtable();
			context.meta = Meta;
			
			while (ReadStatement(context)) { }
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:11,代码来源:N3Parser.cs

示例7: ToSemWeb

        /// <summary>
        /// Takes the contents of a dotNetRDF Graph and inputs it into a SemWeb StatementSink
        /// </summary>
        /// <param name="g">Graph</param>
        /// <param name="mapping">Blank Node Mapping</param>
        /// <param name="sink">Statement Sink</param>
        public static void ToSemWeb(IGraph g, SemWebMapping mapping, StatementSink sink)
        {
            Statement stmt;

            foreach (Triple t in g.Triples)
            {
                stmt = ToSemWeb(t, mapping);
                //Stop adding statements if the sink tells up to stop
                if (!sink.Add(stmt)) return;
            }
        }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:17,代码来源:SemWebConverter.cs

示例8: Select

		bool Select(Statement template, StatementSink sink, bool ask) {
			return Select(
				template.Subject == null ? null : new Entity[] { template.Subject },
				template.Predicate == null ? null : new Entity[] { template.Predicate },
				template.Object == null ? null : new Resource[] { template.Object },
				template.Meta == null ? null : new Entity[] { template.Meta },
				null,
				0,
				sink,
				ask
				);
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:12,代码来源:Remote.cs

示例9: Select

		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);
					}
				}
			}
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:25,代码来源:Euler.cs

示例10: Select

		public void Select(Statement template, StatementSink result) {
			if (result == null) throw new ArgumentNullException();
			Select(template.Subject, template.Predicate, template.Object, template.Meta, null, result, 0);
		}
开发者ID:shariqatariq,项目名称:profiles-rns,代码行数:4,代码来源:SQLStore.cs

示例11: Add

		public static void Add (StatementSink sink, Entity subject, string predicate, string type, string [] values)
		{
			if (values == null) {
				System.Console.WriteLine ("{0} has no values; skipping", predicate);
				return;
			}

                        Entity empty = new SemWeb.BNode();
			Statement top = new Statement (subject, (Entity)MetadataStore.Namespaces.Resolve (predicate), empty);
			Statement desc = new Statement (empty, 
							(Entity)MetadataStore.Namespaces.Resolve ("rdf:type"), 
							(Entity)MetadataStore.Namespaces.Resolve (type));
			sink.Add (desc);
			foreach (string value in values) {
				Statement literal = new Statement (empty,
								   (Entity)MetadataStore.Namespaces.Resolve ("rdf:li"),
								   new SemWeb.Literal (value, null, null));
				sink.Add (literal);
			}
			sink.Add (top);
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:21,代码来源:MetadataStore.cs

示例12: AddLiteral

		public static void AddLiteral (StatementSink sink, string predicate, string value)
		{
			Statement stmt = new Statement (FSpotXMPBase,
							(Entity)MetadataStore.Namespaces.Resolve (predicate), 
							new SemWeb.Literal (value));
			sink.Add (stmt);
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:7,代码来源:MetadataStore.cs

示例13: Select

		public abstract void Select(SelectFilter filter, SelectableSource targetModel, StatementSink sink);
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:1,代码来源:Inference.cs

示例14: Select

		public void Select (StatementSink sink)
		{
			MetadataStore.AddLiteral (sink, "tiff:Orientation", ((int)Info.Orientation).ToString ());
			MetadataStore.AddLiteral (sink, "tiff:ImageWidth", Info.Width.ToString ());
			MetadataStore.AddLiteral (sink, "tiff:ImageLength", Info.Height.ToString ());
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:6,代码来源:X3fFile.cs

示例15: Select

        /// <summary>
        /// Selects Statements from the Source based on a Template
        /// </summary>
        /// <param name="template">Statement Template</param>
        /// <param name="sink">Sink to stream results to</param>
        public void Select(Statement template, StatementSink sink)
        {
            //Convert Template to an Enumerable
            IEnumerable<Triple> ts = Enumerable.Empty<Triple>();
            int hash;

            if (template.Meta != Statement.DefaultMeta && template.Meta != null)
            {
                //Select from the specific Graph if it exists
                Uri graphUri;
                if (template.Meta.Uri == null)
                {
                    hash = new Uri(GraphCollection.DefaultGraphUri).GetEnhancedHashCode();
                    graphUri = null;
                } 
                else 
                {
                    graphUri = new Uri(template.Meta.Uri);
                    hash = graphUri.GetEnhancedHashCode();
                }
                if (this._store.HasGraph(graphUri))
                {
                    ts = this.TemplateToEnumerable(template, this._store.Graph(graphUri));
                    SemWebMapping mapping = this.GetMapping(hash, this._store.Graph(graphUri));

                    foreach (Triple t in ts)
                    {
                        //Keep streaming Triples until the sink tells us to stop
                        Statement stmt = SemWebConverter.ToSemWeb(t, mapping);
                        if (!sink.Add(stmt)) return;
                    }
                }
            }
            else
            {
                //Output the results from each Graph in turn
                foreach (IGraph g in this._store.Graphs)
                {
                    Entity graphUri;
                    if (g.BaseUri == null) 
                    {
                        hash = new Uri(GraphCollection.DefaultGraphUri).GetEnhancedHashCode();
                        graphUri = new Entity(GraphCollection.DefaultGraphUri);
                    } 
                    else 
                    {
                        hash = g.BaseUri.GetEnhancedHashCode();
                        graphUri = new Entity(g.BaseUri.ToString());
                    }
                    SemWebMapping mapping = this.GetMapping(hash, g);
                    foreach (Triple t in this.TemplateToEnumerable(template, g))
                    {
                        Statement stmt = SemWebConverter.ToSemWeb(t, mapping);
                        stmt.Meta = graphUri;
                        if (!sink.Add(stmt)) return;
                    }
                }
            }
        }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:64,代码来源:StoreSource.cs


注:本文中的StatementSink类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。