[siren-user] N-Tuples syntax

Renaud Delbru renaud.delbru at deri.org
Mon Dec 27 18:51:05 GMT 2010


On 27/12/10 17:26, Dario Rigolin wrote:
>> The syntax will be:
>>    "V1.1" "V1.2" "V1.3" "V1.4"...
>>    "V2.1" "V2.2" "V2.3" "V2.4"...
>>    ...
>>
>> In that case, you are implicitly assigning attribute name to column, and
>> an entity / object to to row.
>> Taking the previous example (address), you will have something like:
>> "home" "my street 25" "My city" " My country"
>> "work" "my work street 25" "My work city" " My country"
>> ...
>> Here, the first column represents the attribute 'type', the second the
>> attribute 'street', the third one the attribute 'city, and so on.
> Fine. It's more clear... But what's the syntax to instruct siren to store the
> address? Can I write:
> "home" "my street 25" "My city" " My country" .
> "work" "my work street 25" "My work city" " My country" .
>
> With a dot at the end to instruct that the tuple is finished?
Yes, exactly.
> In siren-solr query language how can I say: give me the document where cell 1
> value is "home" and cell 3 is "My city"? And avoid to retrieve also a record
> with:
There is an code example at [1], but you can constraint the position of 
a cell query with the method SirenCellQuery#setConstraint

final  SirenCellQuery scq =new  SirenCellQuery();
scq.add(new  SirenTermQuery(new  Term(DEFAULT_FIELD, term)), SirenCellClause.Occur.MUST);
scq.setConstraint(cell);

[1] https://dev.deri.ie/confluence/display/SIREn/Indexing+and+Searching+Tabular+Data

> "home" "my street 25" "My home city" " My country" .
> "work" "my work street 25" "My city" " My country" .
>
> "My City" on "work" row?
final  SirenCellQuery scq1 =new  SirenCellQuery();
scq1.add(new  SirenTermQuery(new  Term(DEFAULT_FIELD, "work")), SirenCellClause.Occur.MUST);
scq1.setConstraint(0);

final  SirenCellQuery scq2 =new  SirenCellQuery();
final  SirenPhraseQuery spq =new  SirenPhraseQuery();
spq.add(new  Term(DEFAULT_FIELD,"my"));
spq.add(new  Term(DEFAULT_FIELD,"city"));
scq2.add(spq, SirenCellClause.Occur.MUST);
scq2.setConstraint(2);

final  SirenTupleQuery tq =new  SirenTupleQuery();
tq.add(scq1, SirenTupleClause.Occur.MUST);
tq.add(scq2, SirenTupleClause.Occur.MUST);

-- 
Renaud Delbru



More information about the siren mailing list