@@ -126,12 +126,16 @@ def get_parameters(rq, variables, endpoint, query_metadata, auth=None):
126126 vtype = 'string'
127127 vlang = None
128128 vdatatype = None
129+ vformat = None
129130
130131 mtype = match .group ('type' )
131132 muserdefined = match .group ('userdefined' )
132133
133- if mtype in ['iri' , ' number' ,'literal' ,'string' ]:
134+ if mtype in ['number' ,'literal' ,'string' ]:
134135 vtype = mtype
136+ if mtype in ['iri' ]: #TODO: proper form validation of input parameter uris
137+ vtype = 'string'
138+ vformat = 'iri'
135139 elif mtype :
136140 vtype = 'string'
137141
@@ -149,7 +153,8 @@ def get_parameters(rq, variables, endpoint, query_metadata, auth=None):
149153 'enum' : sorted (vcodes ),
150154 'type' : vtype ,
151155 'datatype' : vdatatype ,
152- 'lang' : vlang
156+ 'lang' : vlang ,
157+ 'format' : vformat
153158 }
154159
155160 glogger .info ('Finished parsing the following parameters: {}' .format (parameters ))
@@ -327,13 +332,16 @@ def rewrite_query(query, parameters, get_args):
327332 # If the parameter has a value
328333 if v :
329334 # IRI
330- if p ['type' ] == 'iri' :
335+ if p ['type' ] == 'iri' : # TODO: never reached anymore, since iris are now type=string with format=iri
331336 query = query .replace (p ['original' ], "{}{}{}" .format ('<' ,v ,'>' ))
332337 # A number (without a datatype)
333338 elif p ['type' ] == 'number' :
334339 query = query .replace (p ['original' ], v )
335340 # Literals
336341 elif p ['type' ] == 'literal' or p ['type' ] == 'string' :
342+ # If it's a iri
343+ if p ['format' ] == 'iri' :
344+ query = query .replace (p ['original' ], "{}{}{}" .format ('<' ,v ,'>' ))
337345 # If there is a language tag
338346 if p ['lang' ]:
339347 query = query .replace (p ['original' ], "\" {}\" @{}" .format (v , p ['lang' ]))
0 commit comments