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


C# IRdfHandler.Apply方法代码示例

本文整理汇总了C#中IRdfHandler.Apply方法的典型用法代码示例。如果您正苦于以下问题:C# IRdfHandler.Apply方法的具体用法?C# IRdfHandler.Apply怎么用?C# IRdfHandler.Apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRdfHandler的用法示例。


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

示例1: LoadGraph

        /// <summary>
        /// Loads a Graph from the Dataset with the given Handler
        /// </summary>
        /// <param name="handler">RDF Handler</param>
        /// <param name="graphUri">URI of the Graph to load</param>
        public void LoadGraph(IRdfHandler handler, Uri graphUri)
        {
            IGraph g = null;
            if (graphUri == null)
            {
                if (this._store.HasGraph(graphUri))
                {
                    g = this._store.Graph(graphUri);
                }
                else
                {
                    foreach (Uri u in WriterHelper.StoreDefaultGraphURIs.Select(s => new Uri(s)))
                    {
                        if (this._store.HasGraph(u))
                        {
                            g = this._store.Graph(u);
                            break;
                        }
                    }
                }
            }
            else if (this._store.HasGraph(graphUri))
            {
                g = this._store.Graph(graphUri);
            }

            handler.Apply(g);
        }
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:33,代码来源:DatasetFileManager.cs

示例2: Query

        /// <summary>
        /// Processes a SPARQL Query against the Knowledge Base passing the results to the RDF or Results handler as appropriate
        /// </summary>
        /// <param name="rdfHandler">RDF Handler</param>
        /// <param name="resultsHandler">Results Handler</param>
        /// <param name="sparqlQuery">SPARQL Query</param>
        /// <param name="callback">Callback to invoke once handling of results has completed</param>
        /// <param name="state">State to pass to the callback</param>
        public void Query(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, String sparqlQuery, QueryCallback callback, Object state)
        {
            SparqlQueryParser parser = new SparqlQueryParser();
            SparqlQuery q = parser.ParseFromString(sparqlQuery);

            SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(UriFactory.Create(this._sparqlUri));
            switch (q.QueryType)
            {
                case SparqlQueryType.Ask:
                case SparqlQueryType.Select:
                case SparqlQueryType.SelectAll:
                case SparqlQueryType.SelectAllDistinct:
                case SparqlQueryType.SelectAllReduced:
                case SparqlQueryType.SelectDistinct:
                case SparqlQueryType.SelectReduced:
                    endpoint.QueryWithResultSet(sparqlQuery, (rs, _) =>
                        {
                            resultsHandler.Apply(rs);
                            callback(rdfHandler, resultsHandler, state);
                        }, state);
                    break;
                case SparqlQueryType.Construct:
                case SparqlQueryType.Describe:
                case SparqlQueryType.DescribeAll:
                    endpoint.QueryWithResultGraph(sparqlQuery, (g, _) =>
                        {
                            rdfHandler.Apply(g);
                            callback(rdfHandler, resultsHandler, state);
                        }, state);
                    break;

                default:
                    throw new RdfQueryException("Cannot execute unknown query types against Pellet Server");
            }
        }
开发者ID:jmahmud,项目名称:RDFer,代码行数:43,代码来源:QueryService.cs

示例3: LoadGraph

 /// <summary>
 /// Loads a Graph from the Store
 /// </summary>
 /// <param name="handler">RDF Handler</param>
 /// <param name="graphUri">Graph URI to load</param>
 public void LoadGraph(IRdfHandler handler, Uri graphUri)
 {
     IGraph g = null;
     if (this._dataset.HasGraph(graphUri))
     {
         g = this._dataset[graphUri];
     }
     handler.Apply(g);
 }
开发者ID:jmahmud,项目名称:RDFer,代码行数:14,代码来源:InMemoryManager.cs

示例4: LoadGraph

        /// <summary>
        /// Loads a Graph from the Store using the given RDF Handler
        /// </summary>
        /// <param name="handler">RDF Handler</param>
        /// <param name="graphUri">URI of the Graph to load</param>
        public virtual void LoadGraph(IRdfHandler handler, Uri graphUri)
        {
            try
            {
                this.Open(true);

                if (this.Exists(graphUri))
                {
                    //Load into an Empty Graph and then Merge
                    IGraph g = new Graph();

                    //Load Namespaces and Triples
                    String graphID = this.GetGraphID(graphUri);
                    this.LoadNamespaces(g, graphID);
                    this.LoadTriples(g, graphID);

                    handler.Apply(g);
                }
                else
                {
                    handler.Apply((IGraph)null);
                }

                this.Close(true);
            }
            catch
            {
                this.Close(true, true);
                throw;
            }
        }
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:36,代码来源:BaseStoreManager.cs


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