Пример #1
0
 /**
  * Attempts to convert a given INode to a String so that it can be parsed into
  * a Jena query object.  The node must be either a string Literal, or a sp:Query node
  * or a template call.  If it's a template call then the resulting query string will
  * "hard-bind" the template variables.
  * @param node  the INode to convert
  * @param usePrefixes  true to use qname abbreviations
  * @return the String representation of node
  * @throws ArgumentException  if the node is not a valid SPIN Query or a String
  * @deprecated for the same reason as {@link TemplateCall.getQueryString}
  */
 public static String getQueryString(IResource node, bool usePrefixes)
 {
     if (node.isLiteral())
     {
         return(((IValuedNode)node.getSource()).AsString());
     }
     else
     {
         ICommand spinCommand = SPINFactory.asCommand(node);
         if (spinCommand != null)
         {
             if (usePrefixes)
             {
                 //StringSparqlPrinter p = new StringSparqlPrinter();
                 //p.setUsePrefixes(usePrefixes);
                 //spinCommand.print(p);
                 //return p.getString();
                 return(String.Empty);
             }
             else
             {
                 return("");//ARQFactory.get().createCommandString(spinCommand);
             }
         }
         else
         {
             ITemplateCall templateCall = SPINFactory.asTemplateCall(node);
             if (templateCall != null)
             {
                 return(templateCall.getQueryString());
             }
             else
             {
                 throw new ArgumentException("INode must be either literal or a SPIN query or a SPIN template call");
             }
         }
     }
 }