|
32 | 32 | # For DNG You can refer to a foldername using e.g. $"folder name" - this gets converted to the URI of the folder in <> NOT EXTENSIVELY TESTED! |
33 | 33 | # You can refer to a user name using e.g. @"user name" - this gets converted to the server-specific URI of the user |
34 | 34 |
|
35 | | -_core_oslc_grammar = """ |
| 35 | +_core_oslc_grammar = r""" |
36 | 36 | ?compound_term : simple_term |
37 | 37 | | simple_term boolean_op compound_term -> do_oslcand |
38 | 38 |
|
|
77 | 77 | | urioffoldername |
78 | 78 | | uriofuser |
79 | 79 | | uriofmodule |
| 80 | + | uriofconfig |
80 | 81 |
|
81 | 82 | valueidentifier : ( ( URI_REF_ESC | NAME | "'" SPACYNAME "'" ) ":" )? NAME |
82 | 83 | | "'" SPACYNAME "'" |
|
90 | 91 |
|
91 | 92 | urioffoldername : "$" string_esc |
92 | 93 |
|
| 94 | +uriofconfig : "#" string_esc |
| 95 | +
|
93 | 96 | uriofuser : "@" string_esc |
94 | 97 |
|
95 | 98 | uriofmodule : "^" string_esc |
@@ -174,6 +177,7 @@ def __init__(self,resolverobject): |
174 | 177 | self.mapping_users = {} # contains both: key name->uri and key uri->name (uris and names never overlap) |
175 | 178 | self.mapping_modules = {} # contains both: key name->uri and key uri->name (uris and names never overlap) |
176 | 179 | self.mapping_projects = {} # contains both: key name->uri and key uri->name (uris and names never overlap) |
| 180 | + self.mapping_configs = {} # contains both: key name->uri and key uri->name (uris and names never overlap) |
177 | 181 |
|
178 | 182 | def where_expression(self, s): |
179 | 183 | logger.debug( f"where_expression {s=}" ) |
@@ -265,7 +269,7 @@ def term(self, s): |
265 | 269 | else: |
266 | 270 | t1 = type(value) |
267 | 271 | logger.info( f"t1 {value} {t1=}" ) |
268 | | - if isinstance(value, str) and not value.startswith('"') and not value.startswith("'") and ':' not in value and not re.match("\d",value): |
| 272 | + if isinstance(value, str) and not value.startswith('"') and not value.startswith("'") and ':' not in value and not re.match(r"\d",value): |
269 | 273 | # this is a valueidentifier - try to resolve it as an enum in the context of identifier |
270 | 274 | if self.resolverobject.resolve_enum_name_to_uri is not None: |
271 | 275 | result = self.resolverobject.resolve_enum_name_to_uri(value, identifier) |
@@ -371,6 +375,21 @@ def uriofmodule(self,s): |
371 | 375 | raise Exception( "This application doesn't support module names!" ) |
372 | 376 | return result |
373 | 377 |
|
| 378 | + def uriofconfig(self,s): |
| 379 | + logger.info( f"uriofconfig {s=}" ) |
| 380 | + name=s[0].strip('"') |
| 381 | + if self.resolverobject.resolve_configname_to_uri is not None: |
| 382 | + uri = self.resolverobject.resolve_configname_to_uri(name) |
| 383 | + if uri is None: |
| 384 | + raise Exception( f"Config {name} not found!" ) |
| 385 | + logger.info( f"uriofconfig {uri=}" ) |
| 386 | + self.mapping_configs[name]=uri |
| 387 | + self.mapping_configs[uri]=name |
| 388 | + result = "<"+uri+">" |
| 389 | + else: |
| 390 | + raise Exception( "This application doesn't support resolving configuration names!" ) |
| 391 | + return result |
| 392 | + |
374 | 393 | # def uriofproject(self,s): |
375 | 394 | # logger.info( f"uriofproject {s=}" ) |
376 | 395 | # name=s[0].strip('"') |
@@ -536,7 +555,7 @@ def scoped_term(self, s): |
536 | 555 | SPACYNAME : /[a-zA-Z0-9_][^']*/ |
537 | 556 | """ |
538 | 557 |
|
539 | | -_orderby_grammar = """ |
| 558 | +_orderby_grammar = r""" |
540 | 559 | sort_terms : sort_term ("," sort_term)* |
541 | 560 | sort_term : scoped_sort_terms | signedterm |
542 | 561 | signedterm : SIGN ( dottedname | identifier ) |
|
0 commit comments