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