Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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(  );
 }
Ejemplo n.º 3
0
        public QueryGroup Resolve(ResourceMap map)
        {
            QueryGroupOr newGroup = new QueryGroupOr();

            foreach (QueryGroup group in itsGroups)
            {
                try {
                    newGroup.Add(group.Resolve(map));
                }
                catch (UnknownGraphMemberException) { }
            }
            return(newGroup);
        }