Beispiel #1
0
        private static IDataObjectContext MakeSparqlDataObjectContext(ConnectionString connectionString)
        {
            var queryEndpoint = new SparqlRemoteEndpoint(new Uri(connectionString.DnrQuery));

            if (!String.IsNullOrEmpty(connectionString.UserName) && !String.IsNullOrEmpty(connectionString.Password))
            {
                queryEndpoint.SetCredentials(connectionString.UserName, connectionString.Password);
            }
            var queryProcessor = new RemoteQueryProcessor(queryEndpoint);

            ISparqlUpdateProcessor updateProcessor = null;

            if (!String.IsNullOrEmpty(connectionString.DnrUpdate))
            {
#if PORTABLE || SILVERLIGHT
                throw new NotSupportedException("The PCL and mobile builds of BrightstarDB do not currently support stores that use SPARQL Update. The store may be opened as a read-only store by removing the update= parameter in the connection string.");
#else
                var updateEndpoint = new SparqlRemoteUpdateEndpoint(new Uri(connectionString.DnrUpdate));
                if (!String.IsNullOrEmpty(connectionString.UserName) && !String.IsNullOrEmpty(connectionString.Password))
                {
                    updateEndpoint.SetCredentials(connectionString.UserName, connectionString.Password);
                }
                updateProcessor = new RemoteUpdateProcessor(updateEndpoint);
#endif
            }
            return(new SparqlDataObjectContext(queryProcessor, updateProcessor, connectionString.OptimisticLocking));
        }
        public TripleStoreRepository(IOptionsMonitor <ColidTripleStoreOptions> options)
        {
            var updateEndpoint = new SparqlRemoteUpdateEndpoint(options.CurrentValue.UpdateUrl);

            updateEndpoint.SetCredentials(options.CurrentValue.Username, options.CurrentValue.Password);
            _queryEndpoint  = new SparqlRemoteEndpoint(options.CurrentValue.ReadUrl);;
            _updateEndpoint = updateEndpoint;
        }