Exemple #1
0
        public static string ToNQuads(RDFDataset dataset)
        {
            IList <string> quads = new List <string>();

            foreach (string graphName in dataset.GraphNames())
            {
                var eachGraphName = graphName;
                IList <RDFDataset.Quad> triples = dataset.GetQuads(eachGraphName);
                if ("@default".Equals(eachGraphName))
                {
                    eachGraphName = null;
                }
                foreach (RDFDataset.Quad triple in triples)
                {
                    quads.Add(ToNQuad(triple, eachGraphName));
                }
            }

            ((List <string>)quads).Sort(StringComparer.Ordinal);

            string rval = string.Empty;

            foreach (string quad in quads)
            {
                rval += quad;
            }
            return(rval);
        }
Exemple #2
0
        public static string ToNQuads(RDFDataset dataset)
        {
            IList <string> quads = new List <string>();

            foreach (string graphName in dataset.GraphNames())
            {
                var    eachGraphName = graphName;
                JArray triples       = (JArray)dataset.GetQuads(eachGraphName);
                if ("@default".Equals(eachGraphName))
                {
                    eachGraphName = null;
                }
                foreach (RDFDataset.Quad triple in triples)
                {
                    quads.Add(ToNQuad(triple, eachGraphName));
                }
            }
            quads.SortInPlace();
            string rval = string.Empty;

            foreach (string quad in quads)
            {
                rval += quad;
            }
            return(rval);
        }