Hi Richard,

Thank for your precision about how to use d2rq:valueRegex function.

Unfortunately I can't change the database shema because it imposed.

So I will use now d2rq:sqlExpression to solve my problem. But I just still a 
question about this function, if I do this SQL expression :

SELECT DISTINCT parlementaire_amendement.parlementaire_id FROM 
parlementaire_amendement, amendement WHERE 
parlementaire_amendement.amendement_id=amendement.id

MySQL will return multiple rows, so how I can replace "amendement.id", which is 
at the end of the expression, by the value of the current instance ?

Best.

Julien. 

-----Message d'origine-----
De : Richard Cyganiak [mailto:[email protected]] 
Envoyé : dimanche 3 avril 2011 10:12
À : <[email protected]>
Cc : [email protected]
Objet : Re: [d2rq-dev] Regular expression and D2RQ

Hi Julien,

d2rq:valueRegex is just a performance optimization. It specifies a regex that 
matches the *entire* value. It cannot be used to extract a sub-string from the 
value.

It also expects a Java-style regular expression, not a Perl-style regular 
expression. The former don't need to be the enclosing two identical characters.

You probably want to look into d2rq:sqlExpression for solving your task.

(Or fix that database schema! ;-)

Best,
Richard


On 2 Apr 2011, at 17:16, <[email protected]> 
<[email protected]> wrote:

> Hi,
>  
> I have a problem to extract parts of a string. I explain that I have this 
> type of string in one of the following fields in my database:
>  
> a:4:{i:0;s:129:"28  espace Coralium Route nationale 1 Kawéni,  BP 424 
> 97600 Mamoudzou Téléphone : 02 69 61 18 71 Télécopie : 02 69 61 18 72 
> ";i:1;s:44:"1  carrefour de la Liberté 97600 Mamoudzou 
> ";i:2;s:64:"Assemblée nationale 126 rue de l'Université 75355 Paris 07 
> SP ";i:3;s:0:"";}
>            
> And I'd like to extract the two parties which are:
>  
> 28  espace Coralium Route nationale 1 Kawéni,  BP 424 97600 Mamoudzou
>  
> and
>  
> 1 carrefour de la Liberté 97600 Mamoudzou
>  
> and
>  
> Assemblée nationale 126 rue de l'Université 75355 Paris 07 SP
>  
> But that's not all, I would like for each of the parties that I created a 
> property value "v: workAdr". So in this case I should have to see under D2R 
> two occurrences of this property. If I have two parties that are extracted so 
> I should have two occurences of this property and so on.
>  
> To do so I use "d2rq: valueRegex" with the regular expression:
>  
> #”(.*?)”#
>  
> But I get an error when launching the server because of my regex.
>  
> Any idea how to solve this problem?
>  
> Best.
>  
> Julien.
> ----------------------------------------------------------------------
> -------- Create and publish websites with WebMatrix Use the most 
> popular FREE web apps or write code yourself; WebMatrix provides all 
> the features you need to develop and publish your website. 
> http://p.sf.net/sfu/ms-webmatrix-sf
> _______________________________________________
> d2rq-map-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel


------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
d2rq-map-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel

Reply via email to