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


C# Graph.LoadFromString方法代码示例

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


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

示例1: GetDyno

        public static dynamic GetDyno(string data, bool autoquotation = true, 
            bool treatUri = true,
            bool skipTriplesWithEmptyObject = false,
            bool mindAsterisk = false,
            bool useStore = false,
            string defaultGraphUri = "http://test.org/defaultgraph")
        {
            DynamicSPARQLSpace.dotNetRDF.Connector connector = null;

            if (useStore)
            {
                var store = new VDS.RDF.TripleStore();
                store.LoadFromString(data);
                connector =  new Connector(new InMemoryDataset(store, new Uri(defaultGraphUri)));
            }
            else
            {
                var graph = new VDS.RDF.Graph();
                graph.LoadFromString(data);
                connector =  new Connector(new InMemoryDataset(graph));
            }

            dynamic dyno = DynamicSPARQL.CreateDyno(connector.GetQueryingFunction(),
                updateFunc: connector.GetUpdateFunction(),
                autoquotation: autoquotation,
                treatUri: treatUri,
                skipTriplesWithEmptyObject:skipTriplesWithEmptyObject,
                mindAsterisk:mindAsterisk);

            return dyno;
        }
开发者ID:Efimster,项目名称:DynamicSPARQL,代码行数:31,代码来源:TestDataProvider.cs

示例2: LoadFromString

 /// <summary>Loads data from string with optional automated graph generation.</summary>
 /// <param name="store">Target store to be loaded with data.</param>
 /// <param name="data">String with data.</param>
 /// <param name="parser">RDF reader.</param>
 /// <param name="metaGraphUri">When provided, store will have automatically created graphs for all resources that are mentioned in the meta graph provided.</param>
 public static void LoadFromString(this ITripleStore store, string data, IRdfReader parser, Uri metaGraphUri)
 {
     ITripleStore targetStore = (metaGraphUri != null ? new TripleStore() : store);
     IGraph graph = new Graph();
     targetStore.Add(graph);
     graph.LoadFromString(data, parser);
     if (metaGraphUri != null)
     {
         store.ExpandGraphs((TripleStore)targetStore, metaGraphUri);
     }
 }
开发者ID:rafalrosochacki,项目名称:RomanticWeb,代码行数:16,代码来源:TripleStoreExtensions.cs

示例3: CompareResultGraphs

 private void CompareResultGraphs(string results, string expectedResultsPath, bool reduced)
 {
     var expectedResultGraph = new Graph();
     FileLoader.Load(expectedResultGraph, expectedResultsPath);
     var resultSet = expectedResultGraph.GetUriNode(new Uri("http://www.w3.org/2001/sw/DataAccess/tests/result-set#ResultSet"));
     if (resultSet != null)
     {
         var rdfParser = new SparqlRdfParser();
         var xmlParser = new SparqlXmlParser();
         var actualResultSet = new SparqlResultSet();
         var expectedResultSet = new SparqlResultSet();
         using (var tr = new StringReader(results))
         {
             xmlParser.Load(actualResultSet, tr);
         }
         rdfParser.Load(expectedResultSet, expectedResultsPath);
         var bnodeMap = new Dictionary<string, string>();
         CompareSparqlResults(actualResultSet, expectedResultSet, reduced, bnodeMap);
     }
     else
     {
         // This is a constructed graph
         var actualGraph = new Graph();
         actualGraph.LoadFromString(results);
         CompareTripleCollections(actualGraph.Triples, expectedResultGraph.Triples, reduced);
     }
 }
开发者ID:Garwin4j,项目名称:BrightstarDB,代码行数:27,代码来源:SparqlTest.cs

示例4: CompareResultGraphs

 private void CompareResultGraphs(string results, string expectedResultsPath, bool reduced)
 {
     var expectedResultGraph = new Graph();
     FileLoader.Load(expectedResultGraph, expectedResultsPath);
     var resultSet = expectedResultGraph.GetUriNode(new Uri("http://www.w3.org/2001/sw/DataAccess/tests/result-set#ResultSet"));
     if (resultSet != null)
     {
         var rdfParser = new SparqlRdfParser();
         var xmlParser = new SparqlXmlParser();
         var actualResultSet = new SparqlResultSet();
         var expectedResultSet = new SparqlResultSet();
         using (var tr = new StringReader(results))
         {
             xmlParser.Load(actualResultSet, tr);
         }
         rdfParser.Load(expectedResultSet, expectedResultsPath);
         var bnodeMap = new Dictionary<string, string>();
         CompareSparqlResults(actualResultSet, expectedResultSet, reduced, bnodeMap);
     }
     else
     {
         // This is a constructed graph
         var actualGraph = new Graph();
         actualGraph.LoadFromString(results);
         var toReplace = actualGraph.Triples.Where(
             t => IsGenid(t.Subject) || IsGenid(t.Predicate) || IsGenid(t.Object)).ToList();
         foreach (var t in toReplace)
         {
             var mapped = MapGenidToBlank(t);
             actualGraph.Retract(t);
             actualGraph.Assert(mapped);
         }
         CompareTripleCollections(actualGraph.Triples, expectedResultGraph.Triples, reduced);
     }
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:35,代码来源:ManifestEvaluation.cs

示例5: WritingRdfXmlWithDtds

        public void WritingRdfXmlWithDtds()
        {
            String fragment = "@prefix xsd: <" + NamespaceMapper.XMLSCHEMA + ">. @prefix : <http://example.org/>. :subj a :obj ; :has \"string\"^^xsd:string ; :has 23 .";
            Graph g = new Graph();
            g.LoadFromString(fragment);

            this.CheckRoundTrip(g);
        }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:8,代码来源:RdfXmlWriterTests.cs

示例6: WritingRdfXmlSimpleCollection

        public void WritingRdfXmlSimpleCollection()
        {
            String fragment = "@prefix : <http://example.org/>. :subj :pred ( 1 2 3 ).";

            Graph g = new Graph();
            g.LoadFromString(fragment);

            this.CheckRoundTrip(g);
        }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:9,代码来源:RdfXmlWriterTests.cs

示例7: WritingRdfXmlSimpleBNodeCollection3

        public void WritingRdfXmlSimpleBNodeCollection3()
        {
            String fragment = "@prefix : <http://example.org/>. :subj :pred [ a :BNode ; :another :thing ].";

            Graph g = new Graph();
            g.LoadFromString(fragment);

            this.CheckRoundTrip(g);
        }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:9,代码来源:RdfXmlWriterTests.cs


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