Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "IdAS String Filters"

(ABNF)
(ABNF)
Line 10: Line 10:
 
filter      = LP filteritem RP
 
filter      = LP filteritem RP
 
filteritem  = assertion / and / or / not
 
filteritem  = assertion / and / or / not
assertion    = resource SP comparator SP value
+
assertion    = attrpresent /
 +
              attreq /     
 +
              attrge /     
 +
              attrle /     
 +
              attrsub /   
 +
              eideq /     
 +
              etypeeq             
 
and          = AMP 1*filter  
 
and          = AMP 1*filter  
 
or          = BAR 1*filter
 
or          = BAR 1*filter
 
not          = EXC filter
 
not          = EXC filter
comparator  =
+
attrpresent  = resource SP "a" ; matches when an entity has an attribute (named by resource) present
resource    =
+
attreq      = resource SP "a=" SP value ; matches when an entity has an attribute (named by resource) with a value equal to value
value        =
+
attrge      = resource SP "a>=" SP value ; matches when an entity has an attribute (named by resource) with a value greater or equal to value
 
+
attrle      = resource SP "a<=" SP value ; matches when an entity has an attribute (named by resource) with a value less or equal to value
 +
attrsub      = resource SP "a*" SP value ; matches when an entity has an attribute (named by resource) with a value containing a substring of value
 +
eideq        = "eid=" SP entityid ; matches when an entity has the id specified in entityid
 +
etypeeq      = "etype=" SP resource ; matches when an entity's type matches that specified in resource
 +
resource    = URI ; typically specifies an attribute ID or entity type
 +
value        = ; TODO: occurrences of RP must be escaped in values
 +
              ; TODO: how are complex attr's represented?
 +
              ; TODO: how are attr's on values represented?
 
LP          = %x28 ; left paren ("(")
 
LP          = %x28 ; left paren ("(")
 
RP          = %x29 ; right paren (")")
 
RP          = %x29 ; right paren (")")

Revision as of 13:04, 30 July 2008

Problem

While the current IFilter, IFilterAssertion (and sub-interfaces) are adequate to perform complex searches across an IdAS context, it is cumbersome to code to them. Furthermore, there is currently no way to represent a filter using a string such that it could be passed easily across a wire protocol

Proposals

ABNF

The following ABNF could be used to represent filters as strings. Note that I simply looked at the way today's IFilter is and extrapolated an ABNF.

filter       = LP filteritem RP
filteritem   = assertion / and / or / not
assertion    = attrpresent / 
               attreq /      
               attrge /      
               attrle /      
               attrsub /     
               eideq /       
               etypeeq              
and          = AMP 1*filter 
or           = BAR 1*filter
not          = EXC filter
attrpresent  = resource SP "a" ; matches when an entity has an attribute (named by resource) present
attreq       = resource SP "a=" SP value ; matches when an entity has an attribute (named by resource) with a value equal to value
attrge       = resource SP "a>=" SP value ; matches when an entity has an attribute (named by resource) with a value greater or equal to value
attrle       = resource SP "a<=" SP value ; matches when an entity has an attribute (named by resource) with a value less or equal to value
attrsub      = resource SP "a*" SP value ; matches when an entity has an attribute (named by resource) with a value containing a substring of value
eideq        = "eid=" SP entityid ; matches when an entity has the id specified in entityid
etypeeq      = "etype=" SP resource ; matches when an entity's type matches that specified in resource
resource     = URI ; typically specifies an attribute ID or entity type
value        = ; TODO: occurrences of RP must be escaped in values
               ; TODO: how are complex attr's represented?
               ; TODO: how are attr's on values represented? 
LP           = %x28 ; left paren ("(")
RP           = %x29 ; right paren (")")
SP           = %x20 ; space (" ")
AMP          = %x26 ; ampersand ("&")
BAR          = %x7C ; vertical bar or pipe ("|")
EXC          = %x21 ; exclamation mark ("!")

Examples

Match for any entity with a telephone number of 888-555-1212 or 888-123-4567

(&(http://example.org/attrs/phonenumber a= 888-555-1212)(http://example.org/attrs/phonenumber a= 888-123-4567))

XML

Back to the top