Esempio n. 1
0
        public QueryGroupPatterns Rest()
        {
            QueryGroupPatterns group = new QueryGroupPatterns();

            group.itsPatterns.AddRange(itsPatterns.GetRange(1, itsPatterns.Count - 1));
            return(group);
        }
Esempio n. 2
0
        public QueryGroup Resolve(TripleStore triples)
        {
            QueryGroupAnd groupAnd = new QueryGroupAnd();

            QueryGroupPatterns groupRequired = new QueryGroupPatterns();

            foreach (Pattern pattern in itsPatterns)
            {
                groupRequired.Add(pattern.Resolve(triples));
            }
            groupAnd.Add(groupRequired);

            if (null != itsOptionalPatterns)
            {
                try {
                    QueryGroupPatterns groupOptional = new QueryGroupPatterns();
                    foreach (Pattern pattern in itsOptionalPatterns.Patterns)
                    {
                        groupOptional.Add(pattern.Resolve(triples));
                    }
                    groupAnd.Add(new QueryGroupOptional(groupOptional));
                }
                catch (UnknownGraphMemberException) {
                    // NOOP
                }
            }

            QueryGroupConstraints groupConstraints = new QueryGroupConstraints();

            foreach (Constraint constraint in itsConstraints)
            {
                groupConstraints.Add(constraint);
            }
            groupAnd.Add(groupConstraints);

            QueryGroupOr alternateGroups = new QueryGroupOr();

            alternateGroups.Add(groupAnd);


            foreach (PatternGroup group in itsAlternateGroups)
            {
                try {
                    QueryGroupPatterns groupAlternate = new QueryGroupPatterns();
                    foreach (Pattern pattern in group.Patterns)
                    {
                        groupAlternate.Add(pattern.Resolve(triples));
                    }
                    alternateGroups.Add(groupAlternate);
                }
                catch (UnknownGraphMemberException) {
                    // NOOP
                }
            }

            return(alternateGroups);
        }
Esempio n. 3
0
        public QueryGroup Resolve(ResourceMap map)
        {
            QueryGroupPatterns newGroup = new QueryGroupPatterns();

            foreach (Pattern pattern in itsPatterns)
            {
                newGroup.Add(pattern.Resolve(map));
            }
            return(newGroup);
        }
Esempio n. 4
0
 public PatternGroup()
 {
     itsPatterns                  = new ArrayList();
     itsAlternateGroups           = new ArrayList();
     itsConstraints               = new ArrayList();
     itsQueryPartAlternate        = new QueryGroupOr();
     itsQueryPartPatterns         = new QueryGroupPatterns();
     itsQueryPartOptionalPatterns = new QueryGroupPatterns();
     itsQueryPartOptional         = new QueryGroupOptional(itsQueryPartOptionalPatterns);
     itsQueryPartConstraints      = new QueryGroupConstraints(  );
 }