예제 #1
0
        /// <summary>
        /// (re)loads file data; existing graph data is overwritten.
        /// </summary>
        /// <returns>
        /// Self graph for loaded data.
        /// </returns>
        public async Task <Graph> Load(Node <FileInfo> file)
        {
            var id = _rdf.Uri(file.Value.AsUri());

            var g = _rdf.GetSelfGraph(id);

            g.Clear();
            await new NTripleFile(file.Value)
            .Read(g);

            _rdf.GetSelfGraph(_rdf.System)
            .Update
            .For(id).With(BackingFile)
            .Set(file);

            return(g);
        }
예제 #2
0
 private Task DelayedDataRead(FileInfo srcFile, IRdfData rdf, int id)
 {
     return(new Task(() =>
     {
         var g = rdf.GetSelfGraph(rdf.BlankSelf($"g{id}"));
         using var rd = srcFile.OpenText();
         NTripleFile.Read(g, rd).Wait();
     }, TaskCreationOptions.LongRunning));
 }
예제 #3
0
 /// <summary>Convert graph to a self-only graph</summary>
 public Graph SelfOnly() => _rdf.GetSelfGraph(Id);