當前位置: 首頁>>代碼示例>>C#>>正文


C# Resource.ToString方法代碼示例

本文整理匯總了C#中SemWeb.Resource.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Resource.ToString方法的具體用法?C# Resource.ToString怎麽用?C# Resource.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SemWeb.Resource的用法示例。


在下文中一共展示了Resource.ToString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Contains

 /// <summary>
 /// Returns whether the Store contains Statements which contain the given Resource
 /// </summary>
 /// <param name="resource">Resource</param>
 /// <returns></returns>
 public bool Contains(Resource resource)
 {
     //Implemented as a SPARQL ASK
     String query = "ASK WHERE {{" + resource.ToString() + " ?p ?o} UNION {?s " + resource.ToString() + " ?o} UNION {?s ?p " + resource.ToString() + "}}";
     return this.ContainsInternal(query);
 }
開發者ID:almostEric,項目名稱:DotNetRDF-4.0,代碼行數:11,代碼來源:NativeStoreSource.cs

示例2: FromSemWeb

 /// <summary>
 /// Helper method which converts a SemWeb resource into a PatternItem for use in a SPARQL Triple Pattern
 /// </summary>
 /// <param name="r">Resource</param>
 /// <param name="mapping">Mapping of Variables &amp; Blank Nodes to Pattern Items</param>
 /// <param name="g">Graph</param>
 /// <returns></returns>
 private PatternItem FromSemWeb(Resource r, IGraph g, Dictionary<String, PatternItem> mapping)
 {
     if (r is Variable)
     {
         if (mapping.ContainsKey(r.ToString()))
         {
             return mapping[r.ToString()];
         }
         else
         {
             PatternItem temp = new VariablePattern(r.ToString());
             mapping.Add(r.ToString(), temp);
             return temp;
         }
     }
     else if (r is BNode)
     {
         if (mapping.ContainsKey(r.ToString()))
         {
             return mapping[r.ToString()];
         }
         else
         {
             PatternItem temp = new BlankNodePattern(r.ToString().Substring(2));
             mapping.Add(r.ToString(), temp);
             return temp;
         }
     }
     else
     {
         return new NodeMatchPattern(SemWebConverter.FromSemWeb(r, this.GetMapping(g)));
     }
 }
開發者ID:almostEric,項目名稱:DotNetRDF-4.0,代碼行數:40,代碼來源:StoreSource.cs

示例3: S

		string S(Resource r, string v) {
			if (r == null || r is Variable) {
				return v;
			} else if (r is Literal) {
				return r.ToString();
			} else if (r.Uri != null) {
				if (r.Uri.IndexOf('>') != -1)
					throw new ArgumentException("Invalid URI: " + r.Uri);
				return "<" + r.Uri + ">";
			} else {
				throw new NotSupportedException("Blank node in select not supported.");
			}
		}
開發者ID:CTSIatUCSF,項目名稱:ProfilesRNS10x-OpenSocial,代碼行數:13,代碼來源:SparqlClient.cs


注:本文中的SemWeb.Resource.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。