Beispiel #1
0
        public IEnumerable <TripleOVStruct> GetTriplesWithSubject(ObjectVariants subj)
        {
            return(ps_index.GetRecordsWithKey2(((OV_iriint)subj).code)
                   .Cast <object[]>()

                   .Select(rec => new TripleOVStruct(null, NodeGenerator.GetUri(rec[1]), rec[2].ToOVariant(NodeGenerator))));
        }
Beispiel #2
0
 public IEnumerable <TripleOVStruct> GetTriplesWithPredicate(ObjectVariants pred)
 {
     return(ps_index.GetRecordsWithKey1(((OV_iriint)pred).code)
            .Cast <object[]>()
            .Select(rec =>
                    new TripleOVStruct(NodeGenerator.GetUri(rec[0]), null, rec[2].ToOVariant(NodeGenerator))));
 }
Beispiel #3
0
        public IEnumerable <ObjectVariants> GetSubjects(ObjectVariants pred, ObjectVariants obj)
        {
            return(po_index.GetRecordsWithKeys(((OV_iriint)pred).code, obj)
                   .Cast <object[]>()

                   .Select(rec => NodeGenerator.GetUri(rec[0])));
        }
Beispiel #4
0
 public IEnumerable <ObjectVariants> GetAllSubjects()
 {
     return
         (ps_index.GetRecordsAll()
          .Cast <object[]>()
          .Select(row => (int)row[0])
          .Distinct()
          .Select(uri => NodeGenerator.GetUri(uri)));
 }
Beispiel #5
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 #6
0
 public IEnumerable <T> GetTriples <T>(Func <ObjectVariants, ObjectVariants, ObjectVariants, T> returns)
 {
     if (Table.TableCell.Root.Count() == 0)
     {
         return(Enumerable.Empty <T>());
     }
     return(ps_index.GetRecordsAll()
            .Cast <object[]>()
            .Select(
                rec =>
                returns(NodeGenerator.GetUri(rec[0]), NodeGenerator.GetUri(rec[1]),
                        rec[2].ToOVariant(NodeGenerator))));
 }
        public SparqlEqualsExpression(SparqlExpression l, SparqlExpression r, NodeGenerator ng)
        {
            var lc = l.Const;
            var rc = r.Const;

            switch (NullablePairExt.Get(lc, rc))
            {
            case NP.bothNull:
                Operator       = result => l.TypedOperator(result).Equals(r.TypedOperator(result));
                AggregateLevel = SetAggregateLevel(l.AggregateLevel, r.AggregateLevel);
                break;

            case NP.leftNull:
                if (rc.Variant == ObjectVariantEnum.Iri)
                {
                    OV_iriint rcCoded = null;
                    Operator = result =>
                    {
                        var lVal = l.TypedOperator(result);
                        if (lVal.Variant == ObjectVariantEnum.Iri)
                        {
                            return(lVal.Equals(rc));
                        }
                        if (lVal.Variant == ObjectVariantEnum.IriInt)
                        {
                            if (rcCoded == null)
                            {
                                rcCoded = (OV_iriint)ng.GetUri((string)rc.Content);
                            }
                            return(((OV_iriint)lVal).code == rcCoded.code);
                        }
                        else
                        {
                            throw new AggregateException();
                        }
                    };
                }
                else
                {
                    Operator = result => l.TypedOperator(result).Equals(rc);
                }
                AggregateLevel = l.AggregateLevel;
                break;

            case NP.rigthNull:
                if (lc.Variant == ObjectVariantEnum.Iri)
                {
                    OV_iriint lcCoded = null;
                    Operator = result =>
                    {
                        var rVal = r.TypedOperator(result);
                        if (rVal.Variant == ObjectVariantEnum.Iri)
                        {
                            return(rVal.Equals(lc));
                        }
                        if (rVal.Variant == ObjectVariantEnum.IriInt)
                        {
                            if (lcCoded == null)
                            {
                                lcCoded = (OV_iriint)ng.GetUri((string)lc.Content);
                            }
                            return(((OV_iriint)rVal).code == lcCoded.code);
                        }
                        else
                        {
                            throw new AggregateException();
                        }
                    };
                }
                else
                {
                    Operator = result => lc.Equals(r.TypedOperator(result));
                }
                AggregateLevel = r.AggregateLevel;
                break;

            case NP.bothNotNull:
                Const = new OV_bool(lc.Equals(rc));
                break;
            }
            TypedOperator = result => new OV_bool(Operator(result));
        }
Beispiel #8
0
 public IEnumerable <TripleOVStruct> GetTriplesWithObject(ObjectVariants obj)
 {
     return(po_index.GetRecordsWithKey2(obj)
            .Cast <object[]>()
            .Select(rec => new TripleOVStruct(NodeGenerator.GetUri(rec[0]), NodeGenerator.GetUri(rec[1]), obj)));
 }
 public SparqlIriExpression(string sparqlUriNode, NodeGenerator q)
 {
     // TypedOperator = result => uri;
     this.Const = q.GetUri(sparqlUriNode);
 }
        public SparqlIriExpression(string sparqlUriNode, NodeGenerator q)
        {
            var uri = q.GetUri(sparqlUriNode);

            Func = result => uri;
        }