You could maybe getPrologue() from the original query and then
setPrologue() on the resulting one.
https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/query/Query.html#getPrologue()

On Wed, Sep 15, 2021 at 9:51 PM Guillermo Coscarelli
<guillermo.coscare...@mulesoft.com.invalid> wrote:
>
> Hi,
>
> Right now when I parse a query that has prefixes and pass through the
> Algebra.compile() method it expands all prefixes. Is there a way to keep
> them
>
> Code is basically:
>
> PREFIX  e:    <http://learningsparql.com/ns/expenses#>
>
> SELECT  ?description (SUM(?amount) AS ?mealTotal)
> WHERE
>   { ?meal  e:description  ?description ;
>            e:amount       ?amount
>   }
> GROUP BY ?description
> HAVING ( SUM(?amount) > 20 )
>
> val q = QueryFactory.create(query)
>
> val op = Algebra.compile(q)
>
> OpAsQuery.asQuery(op)
>
> SELECT  ?description (SUM(?amount) AS ?mealTotal)
> WHERE
>   { ?meal  <http://learningsparql.com/ns/expenses#description>
>  ?description ;
>            <http://learningsparql.com/ns/expenses#amount>  ?amount
>   }
> GROUP BY ?description
> HAVING ( SUM(?amount) > 20 )
>
> I hope there is a way
>
> Thanks
>
> Guillermo.
>
>
> --
> <https://www.mulesoft.com/>
> Guillermo Coscarelli, Principal Software Engineer
>
> PARQUE AUSTRAL - Av. Cayetano Beliera 3025
> Edificio M4 - Pilar (B1629HVK)
> Provincia de Buenos Aires - Argentina
>
> O + <555.555.5555>54 (230) 438-4933  M +54 (911) 5956-6026
>
> <https://www.linkedin.com/company/mulesoft>   <https://twitter.com/mulesoft>
>    <https://www.facebook.com/MuleSoft>   <https://videos.mulesoft.com/> We're
> hiring! <https://www.mulesoft.com/careers>
>
> *NOTICE: This e-mail may contain confidential information. Any pricing
> information contained in this communication is confidential MuleSoft
> information. If you are not the addressee or the intended recipient please
> do not read this e-mail and please immediately delete this e-mail message
> and any attachments from your network mail system. If you are the addressee
> or the intended recipient and you save or print a copy of this e-mail,
> please place it in an appropriate file, depending on whether confidential
> information is contained in the message, and please treat all MuleSoft
> confidential information with heightened protection.*

Reply via email to