Esempio n. 1
0
        public  IEnumerable<SparqlResult> SpoVarGraphs( VariableNode subj, ObjectVariants predicateNode,
            ObjectVariants objectNode, SparqlResult variablesBindings, VariableDataSet variableDataSet)
        {
            return SpoCacheGraphs(predicateNode, objectNode, variableDataSet) //.GetGraphUri(variablesBindings) if graphs is empty, Gets All named graphs
                .SelectMany(grouping =>
                   grouping.Select(node =>
                       new SparqlResult(variablesBindings, node, subj, grouping.Key, variableDataSet.Variable))); // if graphVariable is null, ctor check this.

        }
Esempio n. 2
0
 public  IEnumerable<SparqlResult> SPoVarGraphs( VariableNode subj, VariableNode pred,
    ObjectVariants obj, SparqlResult variablesBindings, VariableDataSet variableDataSet)
 {
     return SPoCacheGraphs(obj, variableDataSet) //.GetGraphUri(variablesBindings)
      .SelectMany(grouping =>
              grouping
                 .Select(triple => new SparqlResult(new Dictionary<VariableNode, SparqlVariableBinding>(variablesBindings.row)
       {
           {pred, new SparqlVariableBinding(pred,triple.Predicate)},
           {subj, new SparqlVariableBinding(subj,triple.Subject)},
           {variableDataSet.Variable, new SparqlVariableBinding(variableDataSet.Variable,grouping.Key)},
       })));
 }
Esempio n. 3
0
 public SparqlTriple(ObjectVariants subj, ObjectVariants pred, ObjectVariants obj, RdfQuery11Translator q)
 {
     this.q    = q;
     Subject   = subj;
     Predicate = pred;
     Object    = obj;
     //if(!(subj is ObjectVariants)) throw new ArgumentException();
     graphs = q.ActiveGraphs;
     //this.Graph = graph;
     sVariableNode   = subj as VariableNode;
     pVariableNode   = pred as VariableNode;
     oVariableNode   = obj as VariableNode;
     variableDataSet = (q.ActiveGraphs as VariableDataSet);
     isDefaultGraph  = variableDataSet == null && graphs.Count == 0;
 }
Esempio n. 4
0
 public IEnumerable<SparqlResult> SPOVarGraphs(VariableNode subj, VariableNode predicate, VariableNode obj,
     SparqlResult variablesBindings, VariableDataSet variableDataSet)
 {
     return store
         .NamedGraphs
         .GetTriplesFromGraphs(variableDataSet) //.GetGraphUri(variablesBindings)
         .SelectMany(grouping =>
             grouping
                 .Select(
                     triple =>
                         new SparqlResult(
                             new Dictionary<VariableNode, SparqlVariableBinding>(variablesBindings.row)
                             {
                                 {subj, new SparqlVariableBinding(subj, triple.Subject)},
                                 {predicate, new SparqlVariableBinding(predicate, triple.Predicate)},
                                 {obj, new SparqlVariableBinding(obj, triple.Object)}
                             })));
 }
Esempio n. 5
0
 public IEnumerable<SparqlResult> spoVarGraphs(ObjectVariants subjectNode, ObjectVariants predicateNode, ObjectVariants objectNode,
     SparqlResult variablesBindings, VariableDataSet graphs)
 {
     return spoGraphsCache(subjectNode, predicateNode, objectNode, graphs)  
       .Select(g => new SparqlResult(variablesBindings, g, graphs.Variable)) ;
 }
Esempio n. 6
0
 public IEnumerable<SparqlResult> SpOVarGraphs(VariableNode s, ObjectVariants predicate, VariableNode o, SparqlResult variablesBindings, VariableDataSet graphs)
 {
     return SpOCacheGraphs(predicate, graphs) //.GetGraphUri(variablesBindings))
      .SelectMany(grouping =>
              grouping
                 .Select(triple => new SparqlResult(new Dictionary<VariableNode, SparqlVariableBinding>(variablesBindings.row)
       {
           {s, new SparqlVariableBinding(s,triple.Subject)},
           {o, new SparqlVariableBinding(o,triple.Object)}, 
           {graphs.Variable, new SparqlVariableBinding(graphs.Variable,grouping.Key)}
       })));
 }
Esempio n. 7
0
 public  IEnumerable<SparqlResult> sPoVarGraphs( ObjectVariants subj, VariableNode pred, ObjectVariants obj, SparqlResult variablesBindings, VariableDataSet variableDataSet)
 {
     return sPoCacheGraphs(subj, obj, variableDataSet) //.GetGraphUri(variablesBindings)
        .SelectMany(grouping =>
                grouping.Select(node =>
                    new SparqlResult(variablesBindings, node, pred, grouping.Key, variableDataSet.Variable)));
 }
 // from merged named graphs
 public IEnumerable <SparqlResult> spOVarGraphs(ObjectVariants subjNode, ObjectVariants predicateNode,
                                                VariableNode obj, SparqlResult variablesBindings, VariableDataSet variableDataSet)
 {
     if (variableDataSet.Any())
     {
         return(variableDataSet.SelectMany(g => store
                                           .NamedGraphs
                                           .GetObject(subjNode, predicateNode, g)
                                           .Select(o => variablesBindings.Add(o, obj, g, variableDataSet.Variable))));
     }
     else
     {
         return(store
                .NamedGraphs
                .GetTriplesWithSubjectPredicate(subjNode, predicateNode,
                                                ((o, g) => variablesBindings.Add(o, obj, g, variableDataSet.Variable))));
     }
     // if graphVariable is null, ctor check this.
 }
 public IEnumerable <SparqlResult> SpoVarGraphs(VariableNode subj, ObjectVariants predicateNode,
                                                ObjectVariants objectNode, SparqlResult variablesBindings, VariableDataSet variableDataSet)
 {
     if (variableDataSet.Any())
     {
         return(variableDataSet.SelectMany(g => store
                                           .NamedGraphs
                                           .GetSubject(predicateNode, objectNode, g)
                                           .Select(s => variablesBindings.Add(s, subj, g, variableDataSet.Variable))));
     }
     else
     {
         return(store
                .NamedGraphs
                .GetTriplesWithPredicateObject(predicateNode, objectNode,
                                               (s, g) => variablesBindings.Add(s, subj, g, variableDataSet.Variable)));
     }
 }
 public IEnumerable <SparqlResult> spoVarGraphs(ObjectVariants subjectNode, ObjectVariants predicateNode, ObjectVariants objectNode,
                                                SparqlResult variablesBindings, VariableDataSet graphs)
 {
     return((graphs.Any()
         ? graphs.Where(g => store.NamedGraphs.Contains(subjectNode, predicateNode, objectNode, g))
         : store.NamedGraphs.GetGraph(subjectNode, predicateNode, objectNode))
            .Select(g => variablesBindings.Add(g, graphs.Variable)));
 }
 public IEnumerable <SparqlResult> SPOVarGraphs(VariableNode subj, VariableNode predicate, VariableNode obj, SparqlResult variablesBindings, VariableDataSet variableDataSet)
 {
     if (variableDataSet.Any())
     {
         return(variableDataSet.SelectMany(g =>
                                           store
                                           .NamedGraphs
                                           .GetTriplesFromGraph(g, (s, p, o) =>
                                                                variablesBindings.Add(s, subj, p, predicate, o, obj, g,
                                                                                      variableDataSet.Variable))));
     }
     return(store
            .NamedGraphs
            .GetAll((s, p, o, g) =>
                    variablesBindings.Add(s, subj, p, predicate, o, obj, g,
                                          variableDataSet.Variable)));
 }
 public IEnumerable <SparqlResult> SPoVarGraphs(VariableNode subj, VariableNode pred,
                                                ObjectVariants obj, SparqlResult variablesBindings, VariableDataSet variableDataSet)
 {
     if (variableDataSet.Any())
     {
         return(variableDataSet.SelectMany(g =>
                                           store
                                           .NamedGraphs
                                           .GetTriplesWithObjectFromGraph(obj, g, (s, p) =>
                                                                          variablesBindings.Add(p, pred, s, subj, g, variableDataSet.Variable))));
     }
     return(store
            .NamedGraphs
            .GetTriplesWithObject(obj, (s, p, g) =>
                                  variablesBindings.Add(p, pred, s, subj, g, variableDataSet.Variable)));
 }
 public IEnumerable <SparqlResult> sPOVarGraphs(ObjectVariants subj, VariableNode pred,
                                                VariableNode obj, SparqlResult variablesBindings, VariableDataSet variableDataSet)
 {
     if (variableDataSet.Any())
     {
         return(variableDataSet.SelectMany(g =>
                                           store
                                           .NamedGraphs
                                           .GetTriplesWithSubjectFromGraph(subj, g, (p, o) =>
                                                                           variablesBindings.Add(p, pred, o, obj, g, variableDataSet.Variable))));
     }
     else
     {
         return(store
                .NamedGraphs
                .GetTriplesWithSubject(subj, (p, o, g) =>
                                       variablesBindings.Add(p, pred, o, obj, g, variableDataSet.Variable)));
     }
 }
 public IEnumerable <SparqlResult> SpOVarGraphs(VariableNode sVar, ObjectVariants predicate, VariableNode oVar, SparqlResult variablesBindings, VariableDataSet graphs)
 {
     if (graphs.Any())
     {
         return
             (graphs.SelectMany(g =>
                                store.NamedGraphs.GetTriplesWithPredicateFromGraph(predicate, g, (s, o) =>
                                                                                   variablesBindings.Add(s, sVar, o, oVar, g, graphs.Variable))));
     }
     else
     {
         return(store.NamedGraphs.GetTriplesWithPredicate(predicate, (s, o, g) =>
                                                          variablesBindings.Add(s, sVar, o, oVar, g, graphs.Variable)));
     }
 }