Ejemplo n.º 1
0
        public void TestGetMatchesWithDifferentTriplePatterns()
        {
            var c = new TripleCollection();

            c.AddRange(new [] { T1, T2, T3, T4, T5, T6 });
            Assert.AreEqual(1, c.GetMatches(new Triple {
                Subject = "http://example.org/s", Predicate = "http://example.org/p", Object = "http://example.org/o", Graph = Constants.DefaultGraphUri
            }).Count(),
                            "Expected 1 match with fully-specified pattern");
            Assert.AreEqual(2, c.GetMatches(new Triple {
                Subject = "http://example.org/s", Predicate = "http://example.org/p", Object = "http://example.org/o", Graph = null
            }).Count(),
                            "Expected two matches with graph wildcard.");
            // With Triple.Match an object wildcard matches literals and non-literals alike
            Assert.AreEqual(3, c.GetMatches(new Triple {
                Subject = "http://example.org/s", Predicate = "http://example.org/p", Object = null, Graph = Constants.DefaultGraphUri
            }).Count(),
                            "Expected 3 matches with object wildcard");
            Assert.AreEqual(2, c.GetMatches(new Triple {
                Subject = "http://example.org/s", Predicate = null, Object = "http://example.org/o", Graph = Constants.DefaultGraphUri
            }).Count(),
                            "Expected 2 matches with predicate wildcard");
            Assert.AreEqual(2, c.GetMatches(new Triple {
                Subject = null, Predicate = "http://example.org/p", Object = "http://example.org/o", Graph = Constants.DefaultGraphUri
            }).Count(),
                            "Expected 2 matches with subject wildcard");
        }
Ejemplo n.º 2
0
        public void TestAddUpdatesCollection()
        {
            var c = new TripleCollection();

            c.Add(T1);
            Assert.AreEqual(1, c.Count());
            Assert.IsTrue(c.Items.Any(x => x.Equals(T1)));
        }
Ejemplo n.º 3
0
        public void TestGetMatchesBySubject()
        {
            var c = new TripleCollection();

            c.AddRange(new[] { T1, T2, T3, T4, T5, T6 });
            Assert.AreEqual(5, c.GetMatches("http://example.org/s").Count());
            Assert.AreEqual(1, c.GetMatches("http://example.org/s1").Count());
        }
Ejemplo n.º 4
0
        public void TestContainsSubject()
        {
            var c = new TripleCollection();

            c.AddRange(new[] { T1, T2, T3, T4, T5, T6 });
            Assert.IsTrue(c.ContainsSubject("http://example.org/s"));
            Assert.IsTrue(c.ContainsSubject("http://example.org/s1"));
            Assert.IsFalse(c.ContainsSubject("http://example.org/p"));
        }
Ejemplo n.º 5
0
        public void TestRemoveByObjectDoesNotRemoveLiteralMatches()
        {
            var c = new TripleCollection();

            c.AddRange(new[] { T2, T3 });
            c.RemoveByObject("http://example.org/o");
            Assert.AreEqual(1, c.Count());
            Assert.IsTrue(c.Items.Any(x => x.Equals(T3)));
        }
Ejemplo n.º 6
0
        public void TestRemoveBySubjectPredicateLiteralDoesNotRemoveUriMatches()
        {
            var c = new TripleCollection();

            c.AddRange(new[] { T2, T3 });
            c.RemoveBySubjectPredicateLiteral("http://example.org/s", "http://example.org/p", "http://example.org/o", RdfDatatypes.String, null);
            Assert.AreEqual(1, c.Count());
            Assert.IsTrue(c.Items.Any(x => x.Equals(T2)));
        }
Ejemplo n.º 7
0
        public void TestAddRangeUpdatesCollection()
        {
            var c = new TripleCollection();

            c.AddRange(new [] { T1, T2, T3 });
            Assert.AreEqual(3, c.Count());
            Assert.IsTrue(c.Items.Any(x => x.Equals(T1)));
            Assert.IsTrue(c.Items.Any(x => x.Equals(T2)));
            Assert.IsTrue(c.Items.Any(x => x.Equals(T3)));
        }
Ejemplo n.º 8
0
        public void TestRemoveBySubjectPredicateRemoveAllMatches()
        {
            var c = new TripleCollection();

            c.AddRange(new [] { T1, T5 });
            Assert.AreEqual(2, c.Count());
            c.RemoveBySubjectPredicate("http://example.org/s", "http://example.org/p1");
            Assert.AreEqual(1, c.Count());
            Assert.IsTrue(c.Items.Any(x => x.Equals(T1)));
        }
Ejemplo n.º 9
0
        public void TestRemoveBySubjectRemovesAllMatches()
        {
            var c = new TripleCollection();

            c.AddRange(new [] { T1, T2, T3, T4 });
            Assert.AreEqual(4, c.Count());
            c.RemoveBySubject("http://example.org/s");
            Assert.AreEqual(1, c.Count());
            Assert.IsTrue(c.Items.Any(x => x.Equals(T4)));
        }
Ejemplo n.º 10
0
        public void TestEnumerateSubjects()
        {
            var c = new TripleCollection();

            c.AddRange(new[] { T1, T2, T3, T4, T5, T6 });
            var subjects = c.Subjects.ToList();

            Assert.AreEqual(2, subjects.Count);
            Assert.Contains("http://example.org/s", subjects);
            Assert.Contains("http://example.org/s1", subjects);
        }
Ejemplo n.º 11
0
        public void TestClearRemovesAllTriples()
        {
            var c = new TripleCollection();

            c.AddRange(new[] { T1, T2, T3, T4, T5, T6 });
            var triples = c.Items.ToList();

            Assert.AreEqual(6, triples.Count);
            c.Clear();
            Assert.AreEqual(0, c.Items.Count());
            triples = c.Items.ToList();
            Assert.AreEqual(0, triples.Count);
        }
Ejemplo n.º 12
0
        public void TestEnumerateTriples()
        {
            var c = new TripleCollection();

            c.AddRange(new[] { T1, T2, T3, T4, T5, T6 });
            var triples = c.Items.ToList();

            Assert.AreEqual(6, triples.Count);
            Assert.Contains(T1, triples);
            Assert.Contains(T2, triples);
            Assert.Contains(T3, triples);
            Assert.Contains(T4, triples);
            Assert.Contains(T5, triples);
            Assert.Contains(T6, triples);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Internal method which generates the HTML Output for the Graph
        /// </summary>
        /// <param name="context">Writer Context</param>
        private void GenerateOutput(HtmlWriterContext context)
        {
            // Page Header
            context.HtmlWriter.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML+RDFa 1.0//EN\" \"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd\">");
            context.HtmlWriter.WriteLine();
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Html);
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Head);
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Title);
            context.HtmlWriter.WriteEncodedText("RDF Graph");
            if (context.Graph.BaseUri != null)
            {
                context.HtmlWriter.WriteEncodedText(" - " + context.Graph.BaseUri.AbsoluteUri);
            }
            context.HtmlWriter.RenderEndTag();
            if (!Stylesheet.Equals(String.Empty))
            {
                context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Href, Stylesheet);
                context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
                context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet");
                context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Link);
                context.HtmlWriter.RenderEndTag();
            }
            // TODO: Add <meta> for charset?
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.WriteLine();

            // Start Body
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Body);

            // Title
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.H3);
            context.HtmlWriter.WriteEncodedText("RDF Graph");
            if (context.Graph.BaseUri != null)
            {
                context.HtmlWriter.WriteEncodedText(" - " + context.Graph.BaseUri.AbsoluteUri);
            }
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.WriteLine();

            // Create a Table for the Graph
            context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Table);

            // Create a Table Header
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Thead);
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Th);
            context.HtmlWriter.WriteEncodedText("Subject");
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Th);
            context.HtmlWriter.WriteEncodedText("Predicate");
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Th);
            context.HtmlWriter.WriteEncodedText("Object");
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.WriteLine();

            // Create a Table Body for the Triple
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Tbody);

            TripleCollection triplesDone = new TripleCollection();

            foreach (INode subj in context.Graph.Triples.SubjectNodes)
            {
                IEnumerable <Triple> ts = context.Graph.GetTriplesWithSubject(subj);

                // Start a Row
                context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
                context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);

                // Then a Column for the Subject which spans the correct number of Rows
                context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Rowspan, ts.Count().ToString());

                context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
                context.HtmlWriter.WriteLine();

                // For each Subject add an anchor if it can be reduced to a QName
                if (subj.NodeType == NodeType.Uri)
                {
                    String qname;
                    if (context.QNameMapper.ReduceToQName(subj.ToString(), out qname))
                    {
                        if (!qname.EndsWith(":"))
                        {
                            qname = qname.Substring(qname.IndexOf(':') + 1);
                            context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Name, qname);
                            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.A);
                            context.HtmlWriter.RenderEndTag();
                        }
                    }
                }

                GenerateNodeOutput(context, subj);
                context.HtmlWriter.WriteLine();
                context.HtmlWriter.RenderEndTag();
                context.HtmlWriter.WriteLine();

                bool firstPred = true;
                foreach (Triple t in ts)
                {
                    if (triplesDone.Contains(t))
                    {
                        continue;
                    }
                    if (!firstPred)
                    {
                        // If not the first Triple start a new row
                        context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
                        context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
                    }

                    // Then a Column for the Predicate
                    IEnumerable <Triple> predTriples = context.Graph.GetTriplesWithSubjectPredicate(t.Subject, t.Predicate);
                    context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Rowspan, predTriples.Count().ToString());
                    context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
                    context.HtmlWriter.WriteLine();
                    GenerateNodeOutput(context, t.Predicate);
                    context.HtmlWriter.WriteLine();
                    context.HtmlWriter.RenderEndTag();
                    context.HtmlWriter.WriteLine();

                    // Then we write out all the Objects
                    bool firstObj = true;
                    foreach (Triple predTriple in predTriples)
                    {
                        if (triplesDone.Contains(predTriple))
                        {
                            continue;
                        }
                        if (!firstObj)
                        {
                            // If not the first Triple start a new row
                            context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
                            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
                        }

                        // Object Column
                        context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
                        context.HtmlWriter.WriteLine();
                        GenerateNodeOutput(context, predTriple.Object, predTriple);
                        context.HtmlWriter.WriteLine();
                        context.HtmlWriter.RenderEndTag();
                        context.HtmlWriter.WriteLine();

                        // End of Row
                        context.HtmlWriter.RenderEndTag();
                        context.HtmlWriter.WriteLine();
                        firstObj = false;

                        triplesDone.Add(predTriple);
                    }
                    firstPred = false;
                }
            }


            // End Table Body
            context.HtmlWriter.RenderEndTag();

            // End Table
            context.HtmlWriter.RenderEndTag();

            // End of Page
            context.HtmlWriter.RenderEndTag(); //End Body
            context.HtmlWriter.RenderEndTag(); //End Html
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Internal method which generates the HTML Output for the Graph
        /// </summary>
        /// <param name="context">Writer Context</param>
        private void GenerateOutput(HtmlWriterContext context)
        {
            //Page Header
            context.HtmlWriter.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML+RDFa 1.0//EN\" \"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd\">");
            context.HtmlWriter.WriteLine();
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Html);
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Head);
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Title);
            context.HtmlWriter.WriteEncodedText("RDF Graph");
            if (context.Graph.BaseUri != null)
            {
                context.HtmlWriter.WriteEncodedText(" - " + context.Graph.BaseUri.ToString());
            }
            context.HtmlWriter.RenderEndTag();
            if (!this.Stylesheet.Equals(String.Empty))
            {
                context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Href, this.Stylesheet);
                context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
                context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet");
                context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Link);
                context.HtmlWriter.RenderEndTag();
            }
            //TODO: Add <meta> for charset?
            context.HtmlWriter.RenderEndTag();
#if !NO_WEB
            context.HtmlWriter.WriteLine();
#endif

            //Start Body
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Body);

            //Title
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.H3);
            context.HtmlWriter.WriteEncodedText("RDF Graph");
            if (context.Graph.BaseUri != null)
            {
                context.HtmlWriter.WriteEncodedText(" - " + context.Graph.BaseUri.ToString());
            }
            context.HtmlWriter.RenderEndTag();
#if !NO_WEB
            context.HtmlWriter.WriteLine();
#endif

            //Create a Table for the Graph
            context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Table);

            //Create a Table Header
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Thead);
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Th);
            context.HtmlWriter.WriteEncodedText("Subject");
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Th);
            context.HtmlWriter.WriteEncodedText("Predicate");
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Th);
            context.HtmlWriter.WriteEncodedText("Object");
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.RenderEndTag();
            context.HtmlWriter.RenderEndTag();
#if !NO_WEB
            context.HtmlWriter.WriteLine();
#endif

            //Create a Table Body for the Triple
            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Tbody);

            TripleCollection triplesDone = new TripleCollection();
            foreach (INode subj in context.Graph.Triples.SubjectNodes)
            {
                IEnumerable<Triple> ts = context.Graph.GetTriplesWithSubject(subj);

                //Start a Row
                context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
                context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);

                //Then a Column for the Subject which spans the correct number of Rows
                context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Rowspan, ts.Count().ToString());

                context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
#if !NO_WEB
                context.HtmlWriter.WriteLine();
#endif
                //For each Subject add an anchor if it can be reduced to a QName
                if (subj.NodeType == NodeType.Uri)
                {
                    String qname;
                    if (context.QNameMapper.ReduceToQName(subj.ToString(), out qname))
                    {
                        if (!qname.EndsWith(":"))
                        {
                            qname = qname.Substring(qname.IndexOf(':') + 1);
                            context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Name, qname);
                            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.A);
                            context.HtmlWriter.RenderEndTag();
                        }
                    }
                }

                this.GenerateNodeOutput(context, subj);
#if !NO_WEB
                context.HtmlWriter.WriteLine();
#endif
                context.HtmlWriter.RenderEndTag();
#if !NO_WEB
                context.HtmlWriter.WriteLine();
#endif

                bool firstPred = true;
                foreach (Triple t in ts)
                {
                    if (triplesDone.Contains(t)) continue;
                    if (!firstPred)
                    {
                        //If not the first Triple start a new row
                        context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
                        context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
                    }

                    //Then a Column for the Predicate
                    IEnumerable<Triple> predTriples = context.Graph.GetTriplesWithSubjectPredicate(t.Subject, t.Predicate);
                    context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Rowspan, predTriples.Count().ToString());
                    context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
#if !NO_WEB
                    context.HtmlWriter.WriteLine();
#endif
                    this.GenerateNodeOutput(context, t.Predicate);
#if !NO_WEB
                    context.HtmlWriter.WriteLine();
#endif
                    context.HtmlWriter.RenderEndTag();
#if !NO_WEB
                    context.HtmlWriter.WriteLine();
#endif

                    //Then we write out all the Objects
                    bool firstObj = true;
                    foreach (Triple predTriple in predTriples)
                    {
                        if (triplesDone.Contains(predTriple)) continue;
                        if (!firstObj)
                        {
                            //If not the first Triple start a new row
                            context.HtmlWriter.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
                            context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
                        }

                        //Object Column
                        context.HtmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
#if !NO_WEB
                        context.HtmlWriter.WriteLine();
#endif
                        this.GenerateNodeOutput(context, predTriple.Object, predTriple);
#if !NO_WEB
                        context.HtmlWriter.WriteLine();
#endif
                        context.HtmlWriter.RenderEndTag();
#if !NO_WEB
                        context.HtmlWriter.WriteLine();
#endif

                        //End of Row
                        context.HtmlWriter.RenderEndTag();
#if !NO_WEB
                        context.HtmlWriter.WriteLine();
#endif
                        firstObj = false;

                        triplesDone.Add(predTriple);
                    }
                    firstPred = false;
                }
            }


            //End Table Body
            context.HtmlWriter.RenderEndTag();

            //End Table
            context.HtmlWriter.RenderEndTag();

            //End of Page
            context.HtmlWriter.RenderEndTag(); //End Body
            context.HtmlWriter.RenderEndTag(); //End Html
        }
Ejemplo n.º 15
0
        public void TestAddRaisesArgumentNullException()
        {
            var c = new TripleCollection();

            c.Add(null);
        }
Ejemplo n.º 16
0
        private IEnumerable <Triple> generateGraph(object item, Uri id, Dictionary <string, PropertyMetadata> propertyMetadataDictionary, Dictionary <Type, Uri> classUriTypeDictionary, SerializerOptions serializerOptions, Dictionary <Uri, HashSet <Uri> > serializedSubjects)
        {
            TripleCollection result      = new TripleCollection();
            NodeFactory      nodeFactory = new NodeFactory();
            List <Triple>    triples     = new List <Triple>();
            Type             type        = item.GetType();
            IUriNode         subjectNode = nodeFactory.CreateUriNode(id);

            Uri subjectType = classUriTypeDictionary[type];

            if (serializerOptions != SerializerOptions.ExcludeRdfType)
            {
                triples.Add(new Triple(subjectNode, nodeFactory.CreateUriNode(new Uri(RdfSpecsHelper.RdfType)), nodeFactory.CreateUriNode(subjectType)));
            }
            if (serializedSubjects.ContainsKey(subjectNode.Uri))
            {
                serializedSubjects[subjectNode.Uri].Add(subjectType);
            }
            else
            {
                serializedSubjects.Add(subjectNode.Uri, new HashSet <Uri>()
                {
                    subjectType
                });
            }
            foreach (string propertyName in giveMePropertyNames(type))
            {
                PropertyMetadata propertyMetadata = propertyMetadataDictionary[propertyName];
                object           propertyValue    = type.GetProperty(propertyName).GetValue(item, null);
                if (propertyValue != null)
                {
                    IEnumerable <object> propertyValues = null;
                    if (isTypeEnumerable(propertyValue.GetType()))
                    {
                        propertyValues = (propertyValue as IEnumerable).Cast <object>();
                    }
                    else
                    {
                        propertyValues = new object[] { propertyValue }
                    };
                    foreach (object itemValue in propertyValues)
                    {
                        if (propertyMetadata.IsComplexType)
                        {
                            Uri childId = new Uri(itemValue.GetType().GetProperty(idPropertyName).GetValue(itemValue, null).ToString());
                            triples.Add(new Triple(subjectNode, nodeFactory.CreateUriNode(propertyMetadata.PredicateUri), nodeFactory.CreateUriNode(childId)));
                            triples.AddRange(generateGraph(itemValue, childId, propertyMetadataDictionary, classUriTypeDictionary, serializerOptions, serializedSubjects));
                        }
                        else
                        {
                            ILiteralNode valueNode = null;
                            if (propertyMetadata.ObjectRangeUri != null)
                            {
                                if (propertyMetadata.ObjectRangeUri.ToString() == "http://www.w3.org/2001/XMLSchema#date")
                                {
                                    DateTimeOffset dt = (DateTimeOffset)itemValue;
                                    dt        = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dt, "GMT Standard Time");
                                    valueNode = dt.ToLiteralDate(nodeFactory);
                                }
                                else
                                if (propertyMetadata.ObjectRangeUri.ToString() == "http://www.w3.org/2001/XMLSchema#string")
                                {
                                    valueNode = nodeFactory.CreateLiteralNode(itemValue.ToString());
                                }
                                else
                                if (propertyMetadata.ObjectRangeUri.ToString() == "http://www.w3.org/2001/XMLSchema#dateTime")
                                {
                                    valueNode = ((DateTimeOffset)itemValue).ToLiteral(nodeFactory, true);
                                }
                                else
                                {
                                    valueNode = nodeFactory.CreateLiteralNode(itemValue.ToString(), propertyMetadata.ObjectRangeUri);
                                }
                            }
                            else
                            {
                                valueNode = nodeFactory.CreateLiteralNode(itemValue.ToString());
                            }
                            triples.Add(new Triple(subjectNode, nodeFactory.CreateUriNode(propertyMetadata.PredicateUri), valueNode));
                        }
                    }
                }
            }

            return(triples.Distinct());
        }