示例#1
0
        private bool SubjectMatch(string t, IStoreGraph graph, ObjectQueryModel target)
        {
            if (target.Id != null)
            {
                return(t == target.Id);
            }
            var result = true;

            foreach (var filter in target.Filter)
            {
                switch (filter.Value.Operator)
                {
                case "eq":
                    result &= graph.Exists(t, filter.Key, TripleObject.FromData(filter.Value.Value.ToString()));
                    break;

                case "gt":
                case "ge":
                case "lt":
                case "le":
                case "contains":
                    var match = graph.SP(t, filter.Key).Any(Comparator(filter.Value));
                    result &= match;
                    break;

                default:
                    throw _storeErrors.UnknownComparator;
                }
            }
            return(result);
        }
示例#2
0
 private IEnumerable <string> GetSubjectLink(IStoreGraph graph, string source, string segment)
 {
     if (string.Compare(segment, Constants.AnyPath, StringComparison.Ordinal) == 0)
     {
         return(graph.S(source).Where(x => x.Object.IsID).Select(x => x.Object.ToValue()));
     }
     else
     {
         return(graph.SP(source, segment).Where(x => x.Object.IsID).Select(x => x.Object.ToValue()));
     }
 }
示例#3
0
 private IEnumerable <string> GetSubjectLink(IStoreGraph graph, string source, string segment)
 {
     return(graph.SP(source, segment).Where(x => x.Object.IsID).Select(x => x.Object.ToValue()));
 }