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;
        }
        private static IEnumerable<EntityQuad> GetGraphWithBlankNodes()
        {
            var store = new TripleStore();
            store.LoadFromString(Resource.AsString("TestGraphs.BlankNodes.trig"));

            Debug.WriteLine("Loading original graph with {0} triples", store.Graphs[GraphUri].Triples.Count());
            return from triple in store.Graphs[GraphUri].Triples
                   select triple.ToEntityQuad(EntityId);
        }
示例#3
0
        public static ISPARQLQueryable <T> GetQuerable <T>(string data,
                                                           bool autoquotation              = true,
                                                           bool treatUri                   = true,
                                                           IEnumerable <Prefix> prefixes   = null,
                                                           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)));

                // var store2 = new VDS.RDF.Query.SparqlRemoteEndpoint(new Uri("http://10.109.219.4:9999/blazegraph/"));

                //store2.SetCredentials("");
            }
            else
            {
                var graph = new VDS.RDF.Graph();
                graph.LoadFromFile(data);
                connector = new Connector(new InMemoryDataset(graph));
            }


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

            return(new SPARQLQuery <T>(dyno));
        }