Miguel,

You can create Query object, set some prefixes and then pass this to the parser

QueryFactory.parse(Query, ....)

any PREFIX in the SPARQL query will simple reset the prefix setting.

It's just like

PREFIX ex: <http://example/>
PREFIX ex: <http://example.org/>

the second prefix decl will win out. (This is more important when building up SPARQL Update requests from a number of fragments.)

        Andy

On 05/06/14 12:38, Rob Vesse wrote:
Miguel

I would suggest that you use the third option for prefixes.  Apply the
prefixes in the containing rules file provided they aren't overridden by
the query.

Rob

On 05/06/2014 12:06, "Miguel Bento Alves" <mbentoal...@gmail.com> wrote:

Hi Andy,

I upload the code to https://github.com/mbentoalves/jenaMBA_JENA650. Give
me some feedback if I'm doing well. I changed the files Rule.java and
Tokenizer.java.

As you suggested, I implemented the Sparql command enclosure as:

(\\\SPARQL
PREFIX
SELECT ...

\\\SPARQL)

(I added the tokens of the clauses)

However, I left an "open door" if in future we want go deep in parsing,
overcoming corner cases, and simplify the declaration as my initial
propose:

(PREFIX
SELECT ...

)

Next, I will work on parsing of a Sparql command.

Related with prefixes, in your opinion what is the best approach:
        - The Sparql command has is own prefixes;
        - The prefixes are the same of the rules files, and should be declared 
in
the rules file and not in Sparql command;
        - mixed of the previous situations. The command share the same prefixes
of the rules but can be declared some specific prefix in a given sparql
command.
        
        

Miguel


Reply via email to