Beispiel #1
0
        private string ToSparqlInput(ObjectVariants objectVariants)
        {
            switch (objectVariants.Variant)
            {
            case ObjectVariantEnum.Iri:
            case ObjectVariantEnum.IriInt:

                return("<" + ((IIriNode)objectVariants).UriString + ">");

            case ObjectVariantEnum.Str:
                return("\"" + objectVariants.Content + "\"");

            case ObjectVariantEnum.LanguagedString:
                return("\"" + objectVariants.Content + "\"@" + ((OV_langstring)objectVariants).Lang);

            case ObjectVariantEnum.Decimal:
            case ObjectVariantEnum.Float:
            case ObjectVariantEnum.Int:
            case ObjectVariantEnum.DateTimeZone:
            case ObjectVariantEnum.DateTime:
            case ObjectVariantEnum.Date:
            case ObjectVariantEnum.Time:
            case ObjectVariantEnum.Typed:
            case ObjectVariantEnum.OtherIntType:
            case ObjectVariantEnum.Double:
                return("\"" + objectVariants.Content + "\"^^<" + ((ILiteralNode)objectVariants).DataType + ">");

            case ObjectVariantEnum.Undef:
                return(objectVariants.ToString());

            case ObjectVariantEnum.Index:
            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #2
0
        //public void DeleteFromAll(IEnumerable<TripleOV> triples)
        //{
        //    throw new NotImplementedException();
        //}

        public void Add(ObjectVariants g, ObjectVariants s, ObjectVariants p, ObjectVariants o)
        {
            IGraph graph;

            if (named.TryGetValue(g.ToString(), out graph))
            {
                graph.Add(s, p, o);
            }
        }
Beispiel #3
0
        public IEnumerable <QuadOVStruct> GetTriplesWithSubjectFromGraph(ObjectVariants subjectNode, ObjectVariants graph)
        {
            IGraph g;

            if (!named.TryGetValue(graph.ToString(), out g))
            {
                return(Enumerable.Empty <QuadOVStruct>());
            }
            return(g.GetTriplesWithSubject(subjectNode).Select(t => new QuadOVStruct(null, t.Predicate, t.Object, getGraphUriByName(g))));
        }
Beispiel #4
0
        public IEnumerable <ObjectVariants> GetObject(ObjectVariants subjectNode, ObjectVariants predicateNode, ObjectVariants graph)
        {
            IGraph g;

            if (named.TryGetValue(graph.ToString(), out g))
            {
                return(Enumerable.Empty <ObjectVariants>());
            }
            return(g.GetTriplesWithSubjectPredicate(subjectNode, predicateNode));
        }
Beispiel #5
0
        public IEnumerable <ObjectVariants> GetSubject(ObjectVariants predicateNode, ObjectVariants objectNode, ObjectVariants graph)
        {
            IGraph g;

            if (named.TryGetValue(graph.ToString(), out g))
            {
                return(Enumerable.Empty <ObjectVariants>());
            }
            return(g.GetSubjects(predicateNode, objectNode));
        }
Beispiel #6
0
        public IEnumerable <T> GetTriplesFromGraph <T>(ObjectVariants graph, Func <ObjectVariants, ObjectVariants, ObjectVariants, T> returns)
        {
            IGraph g;

            if (!named.TryGetValue(graph.ToString(), out g))
            {
                return(Enumerable.Empty <T>());
            }
            return(g.GetTriples(returns));
        }
Beispiel #7
0
        public void Add(ObjectVariants graph, IEnumerable <TripleOV> enumerable)
        {
            IGraph g;

            if (!named.TryGetValue(graph.ToString(), out g))
            {
                return;
            }
            g.Add(enumerable);
        }
Beispiel #8
0
        public IEnumerable <TripleOVStruct> GetTriplesWithTextObject(ObjectVariants obj)
        {
            var tableRow = Table.Element(0);

            return(textObjectIndex.FindText(obj.ToString())
                   .Select(offset =>
            {
                tableRow.offset = offset;
                return tableRow.Get();
            })
                   .Cast <object[]>()
                   .Select(rec => new TripleOVStruct(NodeGenerator.GetUri(rec[0]), NodeGenerator.GetUri(rec[1]), null)));
        }
Beispiel #9
0
 public static string GetValue(VariableNode vari, ObjectVariants value)
 {
     return(value.ToString());
 }
Beispiel #10
0
 public override int GetHashCode()
 {
     return((int)(ov.ToString() + p).GetHashModifiedBernstein());
 }