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


C# SemWeb.Statement类代码示例

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


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

示例1: Matches

		public bool Matches(Statement statement) {
			if (Subject != null && Subject != statement.Subject && statement.Subject != null) return false;
			if (Predicate != null && Predicate != statement.Predicate && statement.Predicate != null) return false;
			if (Object != null && Object != statement.Object && statement.Object != null) return false;
			if (Meta != null && Meta != statement.Meta && statement.Meta != null) return false;
			return true;
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:7,代码来源:Statement.cs

示例2: SelectLiteral

 public static Literal SelectLiteral(this SelectableSource src, Statement tpl)
 {
     var st = SelectSingle(src, tpl);
     if (st.HasValue && st.Value.Object is Literal)
         return (Literal)st.Value.Object;
     return null;
 }
开发者ID:Mariamfelicia,项目名称:nreco,代码行数:7,代码来源:SelectableSourceExtensions.cs

示例3: Add

 /// <summary>
 /// Adds the specified statement.
 /// </summary>
 /// <param name="statement">The statement.</param>
 public override void Add(Statement statement)
 {
     if (statement.Meta == Statement.DefaultMeta)
         AddStatement(statement);
     else
         AddFormulaStatement(statement);
 }
开发者ID:shariqatariq,项目名称:profiles-rns,代码行数:11,代码来源:NTriplesWriter.cs

示例4: MetaQuery

		public override MetaQueryResult MetaQuery(Statement[] graph, SemWeb.Query.QueryOptions options, SelectableSource source) {
			SemWeb.Query.MetaQueryResult ret = new SemWeb.Query.MetaQueryResult();
			
			ret.QuerySupported = true;
			
			ret.NoData = new bool[graph.Length];
			for (int i = 0; i < graph.Length; i++) {
				// Take this statement and replace variables by nulls
				// to make it a statement template.
				Statement st = graph[i];
				for (int j = 0; j < 4; j++) {
					if (st.GetComponent(j) is Variable)
						st.SetComponent(j, null);
				}
				
				// See if the store contains this template.
				if (st != Statement.All && !source.Contains(st)) {
					ret.NoData[i] = true;
					continue;
				}
			
				// Process it further in case we have variables
				// with known values, in which case if none of the
				// known values is in the store, we also know this
				// statement is unanswerable.
				for (int j = 0; j < 4; j++) {
					Resource r = graph[i].GetComponent(j);
					
					// No need to check the following given the check above.
					//if (r != null && !(r is Variable) && !source.Contains(r))
					//	ret.NoData[i] = true;
					
					if (r != null && r is Variable && options.VariableKnownValues != null && 
					#if !DOTNET2
					options.VariableKnownValues.Contains((Variable)r)
					#else
					options.VariableKnownValues.ContainsKey((Variable)r)
					#endif
					) {
						bool found = false;
						#if !DOTNET2
						foreach (Resource s in (ICollection)options.VariableKnownValues[(Variable)r]) {
						#else
						foreach (Resource s in (ICollection<Resource>)options.VariableKnownValues[(Variable)r]) {
						#endif
							if (source.Contains(s)) {
								found = true;
								break;
							}
						}
						if (!found) {
							ret.NoData[i] = true;
						}
					}
				}
			}
			
			return ret;
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:59,代码来源:Inference.cs

示例5: MetaQuery

 public override SemWeb.Query.MetaQueryResult MetaQuery(Statement[] graph, SemWeb.Query.QueryOptions options, SelectableSource targetModel)
 {
     QueryCheckArg(graph);
     SemWeb.Query.MetaQueryResult ret = new SemWeb.Query.MetaQueryResult();
     ret.QuerySupported = true;
     // TODO: Best to check also whether variables in the query are even known to us.
     return ret;
 }
开发者ID:shariqatariq,项目名称:profiles-rns,代码行数:8,代码来源:Euler.cs

示例6: QueryCheckArg

		private void QueryCheckArg(Statement[] graph) {
			if (graph == null) throw new ArgumentNullException("graph");
			foreach (Statement s in graph) {
				if (s.Subject == null || s.Predicate == null || s.Object == null || s.Meta == null)
					throw new ArgumentNullException("Graph statements cannot contain a null subject, predicate, or object. Use a Variable instance instead.");
				if (s.Meta != Statement.DefaultMeta && !(s.Meta is Variable))
					throw new NotSupportedException("Graph statements' meta fields must be Statement.DefaultMeta. Other values of meta are not currently supported.");
			}
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:9,代码来源:Euler.cs

示例7: Add

		void Add(Statement schemastatement) {
			if (schemastatement.Predicate == subClassOf && schemastatement.Object is Entity)
				AddRelation(schemastatement.Subject, (Entity)schemastatement.Object, superclasses, subclasses, true);
			if (schemastatement.Predicate == subPropertyOf && schemastatement.Object is Entity)
				AddRelation(schemastatement.Subject, (Entity)schemastatement.Object, superprops, subprops, true);
			if (schemastatement.Predicate == domain && schemastatement.Object is Entity)
				AddRelation(schemastatement.Subject, (Entity)schemastatement.Object, domains, domainof, false);
			if (schemastatement.Predicate == range && schemastatement.Object is Entity)
				AddRelation(schemastatement.Subject, (Entity)schemastatement.Object, ranges, rangeof, false);
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:10,代码来源:RDFS.cs

示例8: Add

		public override void Add(Statement statement) {
			if (statement.AnyNull) throw new ArgumentNullException();
			if (checkForDuplicates && Contains(statement)) return;
			statements.Add(statement);
			if (isIndexed) {
				GetIndexArray(statementsAboutSubject, statement.Subject).Add(statement);
				GetIndexArray(statementsAboutObject, statement.Object).Add(statement);
			}
			if (!checkForDuplicates) distinct = false;
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:10,代码来源:MemoryStore.cs

示例9: Add

 public bool Add(Statement st)
 {
     int s = indexes.ContainsKey(st.Subject) ? (int)indexes[st.Subject] : -1;
     int p = indexes.ContainsKey(st.Predicate) ? (int)indexes[st.Predicate] : -1;
     int o = indexes.ContainsKey(st.Object) ? (int)indexes[st.Object] : -1;
     if (s != -1 && p != -1) { connectivity[s,p]=true; connectivity[p,s]=true; }
     if (s != -1 && o != -1) { connectivity[s,o]=true; connectivity[o,s]=true; }
     if (p != -1 && o != -1) { connectivity[p,o]=true; connectivity[o,p]=true; }
     return true;
 }
开发者ID:shariqatariq,项目名称:profiles-rns,代码行数:10,代码来源:Algos.cs

示例10: 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:CTSIatUCSF,项目名称:ProfilesRNS10x-OpenSocial,代码行数:12,代码来源:SparqlClient.cs

示例11: Add

			public override void Add (Statement stmt) 
			{
				string predicate = stmt.Predicate.Uri;
				string prefix;
				string localname;

				// Fill in the namespaces with nice prefixes
				if (MetadataStore.Namespaces.Normalize (predicate, out prefix, out localname)) {
					if (prefix != null)
						Namespaces.AddNamespace (predicate.Remove (predicate.Length - localname.Length, localname.Length), prefix);
				}
				base.Add (stmt);
			}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:13,代码来源:XmpFile.cs

示例12: AddAxiom

		void AddAxiom(Statement schemastatement) {
			if (schemastatement.Predicate == subClassOf && schemastatement.Object is Entity) {
				AddRelation(schemastatement.Subject, (Entity)schemastatement.Object, superclasses, subclasses);
				AddRelation(schemastatement.Subject, rdfsresource, superclasses, subclasses);
				AddRelation((Entity)schemastatement.Object, rdfsresource, superclasses, subclasses);
			}
			if (schemastatement.Predicate == subPropertyOf && schemastatement.Object is Entity)
				AddRelation(schemastatement.Subject, (Entity)schemastatement.Object, superprops, subprops);
			if (schemastatement.Predicate == domain && schemastatement.Object is Entity) {
				AddRelation(schemastatement.Subject, (Entity)schemastatement.Object, domains, domainof);
				AddRelation((Entity)schemastatement.Object, rdfsresource, superclasses, subclasses);
			}
			if (schemastatement.Predicate == range && schemastatement.Object is Entity) {
				AddRelation(schemastatement.Subject, (Entity)schemastatement.Object, ranges, rangeof);
				AddRelation((Entity)schemastatement.Object, rdfsresource, superclasses, subclasses);
			}
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:17,代码来源:RDFS.cs

示例13: ToSemWeb

        /// <summary>
        /// Converts a dotNetRDF Triple to a SemWeb Statement
        /// </summary>
        /// <param name="t">Triple</param>
        /// <param name="mapping">Mapping of Blank Nodes</param>
        /// <returns></returns>
        public static Statement ToSemWeb(Triple t, SemWebMapping mapping)
        {
            Entity s, p;
            Resource o;
            Statement stmt;
            if (t.IsGroundTriple)
            {
                //Easy to map across without need for BNode mapping
                stmt = new Statement(ToSemWebEntity(t.Subject), ToSemWebEntity(t.Predicate), ToSemWeb(t.Object));
            }
            else
            {
                s = ToSemWebEntity(t.Subject, mapping);
                p = ToSemWebEntity(t.Predicate, mapping);
                o = ToSemWeb(t.Object, mapping);

                stmt = new Statement(s, p, o);
            }
            return stmt;
        }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:26,代码来源:SemWebConverter.cs

示例14: Extract

 public void Extract(Assembly assembly, Store rdfStore)
 {
     var types = assembly.GetExportedTypes();
     foreach (var t in types) {
         // store class hierarchy
         var typeEntity = GetEntity(t);
         if (t.IsInterface) {
             var stType = new Statement(typeEntity, NS.Rdf.typeEntity, NS.CSO.interfaceEntity);
             if (!rdfStore.Contains(stType)) {
                 rdfStore.Add(stType);
                 rdfStore.AddLabel(typeEntity, t.FullName);
             }
         } else if (t.IsClass) {
             var stType = new Statement(typeEntity, NS.Rdf.typeEntity, NS.CSO.classEntity);
             if (!rdfStore.Contains(stType)) {
                 rdfStore.Add(stType);
                 rdfStore.AddLabel(typeEntity, t.FullName);
             }
         } else
             continue;
         if (t.BaseType != null)
             rdfStore.Add(new Statement(typeEntity, NS.Rdfs.subClassOfEntity, GetEntity(t.BaseType) ));
         // store info about interfaces
         var ifaces = t.GetInterfaces();
         foreach (var iType in ifaces) {
             rdfStore.Add(new Statement(typeEntity, NS.CSO.Implements, GetEntity(iType)));
             rdfStore.Add(new Statement(typeEntity, NS.Rdfs.subClassOfEntity, GetEntity(iType)));
         }
         // store info about properties
         var props = t.GetProperties(BindingFlags.Public|BindingFlags.SetProperty|BindingFlags.DeclaredOnly|BindingFlags.Instance);
         foreach (var p in props) {
             var propEntity = NS.DotNet.GetPropertyEntity(p.Name);
             rdfStore.Add(new Statement(propEntity, NS.Rdf.typeEntity, NS.Rdf.PropertyEntity));
             rdfStore.AddLabel(propEntity, p.Name);
             rdfStore.Add(new Statement(propEntity, NS.Rdfs.domainEntity, typeEntity));
         }
     }
 }
开发者ID:Mariamfelicia,项目名称:nreco,代码行数:38,代码来源:AssemblyMetadata.cs

示例15: Remove

        /// <summary>
        /// Removes Triples that match the template from the underlying Store
        /// </summary>
        /// <param name="template">Template</param>
        public void Remove(Statement template)
        {
            //Get the Graphs over which the Remove will operate
            IEnumerable<IGraph> gs;
            if (template.Meta == null)
            {
                gs = this._store.Graphs;
            }
            else
            {
                Uri graphUri = new Uri(template.Meta.Uri);
                if (this._store.HasGraph(graphUri))
                {
                    gs = this._store.Graph(graphUri).AsEnumerable();
                }
                else
                {
                    gs = Enumerable.Empty<IGraph>();
                }
            }

            //Retract the Triples which match the Template in each affected Graph
            foreach (IGraph g in gs)
            {
                IEnumerable<Triple> ts = this.TemplateToEnumerable(template, g);
                g.Retract(ts);
            }
        }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:32,代码来源:StoreSource.cs


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