You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by fuguijie1985 <fu...@126.com> on 2010/05/09 12:51:00 UTC

I need some help.

Dear Sir or Madam:
      I am a developer.I want some tuscany SDO help.In your DataObject comment,I found this method:company.get("department[number=123]") . It's a good method.But would you tell me if I need two or more properties like [number=123name='Jack'],etc,what could I do? Thank you very much!

Re: I need some help.

Posted by kelvin goodson <kg...@thegoodsons.org.uk>.
On Mon, May 10, 2010 at 6:34 AM, Raymond Feng <en...@gmail.com> wrote:
> The get method of SDO uses XPath expressions. In our case, it should be:
> company.get("department[number=123 and name='Jack']")

If the "and" clause happens to work with tuscany I'd be pleasantly
surpised, but it's not part of the SDO 2.1/2.1.1 standard.  If it were
to work it would only work by virtue of accidental use of behaviour of
the underlying emf implementation.  The xpath syntax as described in
the spec is as follows

path ::= (scheme ':')? '/'? (step '/')* step
scheme ::= [^:]+
step ::= '@'? property
| property '[' index_from_1 ']'
| property '.' index_from_0
| reference '[' attribute '=' value ']'
| ".."
property ::= NCName ;; may be simple or complex type
attribute ::= NCName ;; must be simple type
reference :: NCName ;; must be DataObject type
index_from_0 ::= Digits
index_from_1 ::= NotZero (Digits)?
value ::= Literal
| Number
| Boolean
Literal ::= '"' [^"]* '"'
| "'" [^']* "'"
Number ::= Digits ('.' Digits?)?
| '.' Digits
Boolean ::= true
| false
NotZero ::= [1-9]
Digits ::= [0-9]+
;; leading '/' begins at the root
;; ".." is the containing DataObject, using containment properties
;; Only the last step have an attribute as the property


I'm afraid you would have to perform the access using one
property=value  clause and filter the result

Kelvin.


> ________________________________________________________________
> Raymond Feng
> rfeng@apache.org
> Apache Tuscany PMC member and committer: tuscany.apache.org
> Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
> Personal Web Site: www.enjoyjava.com
> ________________________________________________________________
> On May 9, 2010, at 3:51 AM, fuguijie1985 wrote:
>
> Dear Sir or Madam:
>       I am a developer.I want some tuscany SDO help.In your DataObject
> comment,I found this method:company.get("department[number=123]") . It's a
> good method.But would you tell me if I need two or more properties like
> [number=123 name='Jack'],etc,what could I do? Thank you very much!
>
> ________________________________
> 网易为中小企业免费提供企业邮箱(自主域名)
>

Re: I need some help.

Posted by Raymond Feng <en...@gmail.com>.
The get method of SDO uses XPath expressions. In our case, it should be:

company.get("department[number=123 and name='Jack']")

________________________________________________________________ 
Raymond Feng
rfeng@apache.org
Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com
________________________________________________________________

On May 9, 2010, at 3:51 AM, fuguijie1985 wrote:

> Dear Sir or Madam:
>       I am a developer.I want some tuscany SDO help.In your DataObject comment,I found this method:company.get("department[number=123]") . It's a good method.But would you tell me if I need two or more properties like [number=123 name='Jack'],etc,what could I do? Thank you very much!
> 
> 
> 网易为中小企业免费提供企业邮箱(自主域名)