Example #1
0
        private Triple ToTriple(RDFDataset.Quad triple)
        {
            var subj = this.CreateNode(triple.GetSubject());
            var pred = this.CreateNode(triple.GetPredicate());
            var obj  = this.CreateNode(triple.GetObject());

            return(new Triple(subj, pred, obj));
        }
Example #2
0
        internal static Statement AsStatement(this RDFDataset.Quad quad)
        {
            var graph     = (quad.ContainsKey("name") ? quad.GetGraph().AsIri() : null);
            var subject   = quad.GetSubject().AsIri();
            var predicate = quad.GetPredicate().AsIri();

            if (quad.GetObject().IsIRI())
            {
                return(new Statement(subject, predicate, quad.GetObject().AsIri(), graph));
            }

            if (!String.IsNullOrEmpty(quad.GetObject().GetLanguage()))
            {
                return(new Statement(subject, predicate, quad.GetObject().GetValue(), quad.GetObject().GetLanguage(), graph));
            }

            var dataType = (quad.GetObject().GetDatatype() != null ? new Iri(quad.GetObject().GetDatatype()) : null);

            return(new Statement(subject, predicate, quad.GetObject().GetValue(), dataType, graph));
        }
Example #3
0
 public void Assert(RDFDataset.Quad quad)
 {
     Triples.Add(new Triple(quad.GetSubject(), quad.GetPredicate(), quad.GetObject()));
 }