Example #1
0
        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();
            }
        }
Example #2
0
        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();
        }
Example #3
0
File: Graph.cs Project: sq/Fracture
        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();
        }
Example #4
0
 public ParseHandler(IZoneModelParser parser, IFileWriter fileWriter, IGraphWriter graphWriter)
 {
     _parser      = parser;
     _fileWriter  = fileWriter;
     _graphWriter = graphWriter;
 }
Example #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 public GraphContext()
 {
     GraphProvider = new GraphProvider <SparqlBgpEvaluator>(Configuration.Instance.QueryEndpoint);
     GraphWriter   = new GraphWriter(Configuration.Instance.UpdateEndpoint);
 }
Example #6
0
 /// <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;
 }