public static void WriteSubjectTo(this IGraph graph, IGraphWriter writer) { foreach (var s in graph.GetGroupings()) { writer.WriteStartSubject(s.Key); foreach (var p in s) { writer.WriteStartPredicate(p.Key); foreach (var o in p) { writer.WriteObject(o); } writer.WriteEndPredicate(); } writer.WriteEndSubject(); } }
public static void Serialize(this INode root, IGraphWriter writer) { var stack = new Stack <INode>(); writer.BeginWrite(root); foreach (var info in root.TraverseDepthFirst()) { while ((stack.Count > 0) && (stack.Peek() != info.Parent)) { writer.WriteNodeFooter(stack.Pop()); } writer.WriteNodeHeader(info.Node); stack.Push(info.Node); } while (stack.Count > 0) { writer.WriteNodeFooter(stack.Pop()); } writer.EndWrite(); }
public static void Serialize(this INode root, IGraphWriter writer) { var stack = new Stack<INode>(); writer.BeginWrite(root); foreach (var info in root.TraverseDepthFirst()) { while ((stack.Count > 0) && (stack.Peek() != info.Parent)) { writer.WriteNodeFooter(stack.Pop()); } writer.WriteNodeHeader(info.Node); stack.Push(info.Node); } while (stack.Count > 0) writer.WriteNodeFooter(stack.Pop()); writer.EndWrite(); }
public ParseHandler(IZoneModelParser parser, IFileWriter fileWriter, IGraphWriter graphWriter) { _parser = parser; _fileWriter = fileWriter; _graphWriter = graphWriter; }
/// <summary> /// Constructor /// </summary> public GraphContext() { GraphProvider = new GraphProvider <SparqlBgpEvaluator>(Configuration.Instance.QueryEndpoint); GraphWriter = new GraphWriter(Configuration.Instance.UpdateEndpoint); }
/// <summary> /// Creates a new <see cref="GraphSerializer"/> from the given services. /// </summary> /// <param name="services">See <see cref="ISerializationService.Services"/>.</param> /// <param name="configuration">See <see cref="ISerializationService.TypeConfiguration"/>.</param> /// <param name="writer">See <see cref="ISerializationService.GraphWriter"/>.</param> public GraphSerializer(IEnumerable <IGraphService> services, IGraphWriter writer, IEnumerable <ITypeConfiguration> configuration) { Services = services; GraphWriter = writer; TypeConfiguration = configuration; }