Exemple #1
0
        override public void Print(ISparqlPrinter p)
        {
            IVariable asVar = getAs();

            if (asVar != null)
            {
                p.print("(");
            }

            INode  aggType = this.getObject(RDF.PropertyType);
            String aggName = Aggregations.getName(aggType);

            p.printKeyword(aggName);
            p.print("(");

            if (isDistinct())
            {
                p.print("DISTINCT ");
            }

            Triple exprS = this.getProperty(SP.PropertyExpression);

            if (exprS != null && !(exprS.Object is ILiteralNode))
            {
                IResource r    = Resource.Get(exprS.Object, getModel());
                IResource expr = SPINFactory.asExpression(r);
                if (expr is IPrintable)
                {
                    ((IPrintable)expr).Print(p);
                }
                else
                {
                    p.printURIResource(r);
                }
            }
            else
            {
                p.print("*");
            }
            String separator = getString(SP.PropertySeparator);

            if (separator != null)
            {
                p.print("; ");
                p.printKeyword("SEPARATOR");
                p.print("=''"); //"='" + DatasetUtil.escapeString(separator) + "'");
            }
            if (asVar != null)
            {
                p.print(") ");
                p.printKeyword("AS");
                p.print(" ");
                p.print(asVar.ToString());
            }
            p.print(")");
        }
Exemple #2
0
        public List <IResource> getResultVariables()
        {
            List <IResource> results = new List <IResource>();

            foreach (IResource node in getList(SP.PropertyResultVariables))
            {
                results.Add(SPINFactory.asExpression(node));
            }
            return(results);
        }
Exemple #3
0
        private void printProjectExpression(ISparqlPrinter p, IVariable var)
        {
            p.print("((");
            IResource  expr       = var.getResource(SP.PropertyExpression);
            IPrintable expression = (IPrintable)SPINFactory.asExpression(expr);

            expression.Print(p);
            p.print(") ");
            p.printKeyword("AS");
            p.print(" ");
            p.print(var.ToString());
            p.print(")");
        }
Exemple #4
0
        public IResource getExpression()
        {
            IResource expr = getObject(SP.PropertyExpression);

            if (expr != null)
            {
                return(SPINFactory.asExpression(expr));
            }
            else
            {
                return(null);
            }
        }
        public List <IResource> getArguments()
        {
            Dictionary <IResource, IResource> values = getArgumentsMap();

            IResource[]      ps      = getArgumentProperties(values);
            List <IResource> results = new List <IResource>(ps.Length);

            foreach (IResource key in ps)
            {
                IResource node = values[key];
                results.Add(SPINFactory.asExpression(node));
            }
            return(results);
        }