Miles Jordan wrote:
>> Miles Jordan ha scritto:
>>> Hi all,
>>>
>>> When I do request a describeFeatureType, the attribute set as the
>>> primary key doesn't show up - is this normal behavior?
>>>
>>> I've been looking through the WFS spec, trying to find if it is
>>> correct behavior but I can't find anywhere that says to omit it.
>>>
>>> To reproduce:
>>>
>>
http://aadc-dev.aad.gov.au/geoserver/wfs?Request=describeFeatureType&
>> T
>>> yp
>>> eName=aadc:AWS_PT
>>>
>>> This feature should have an element called 'UFI' which is
>> the primary
>>> key for that dataset in Oracle 10g.
>>>
>>> Should it show up or is it correct in not doing so (the
>> same happens
>>> for all other featuretypes)?
>>>
>> That's the default for JDBC data stores, to not include the
>> primary key
>> columns in the
>> feature type. The gt2 API allows to have the primary key
attributes
>> included in the
>> feature as a datastore wide setting, but no datastore so
far makes it
>> configurable at the
>> factory level, so Geoserver can't provide you that setting.
>>
>> If you need key among the attributes, open a jira issue
against this
>> problem.
>> Btw, primary key does not appear among the attributes, but is
>> available
>> in the FID,
>> the feature id. Is that enough for you?
>>
>> Cheers
>> Andrea Aime
>>
>
> Thanks for your reply, Andrea.
>
> Not even the fid is shown in a describeFeatureType (this is
geotools
> 1.3.4 btw). I know the individual values for the primary
key are shown
> as fid in a getFeature request, but I need to be able to view all
> available attributes for a featuretype. IMHO The attribute
used as the
> primary key should be treated the same as any other attribute.
>
> As another example of this, lets say I want to send a getFeature
> request, with a filter that selects a single feature, based on the
> unique identifier. The PropertyName element cannot simply contain
> 'fid', it has to contain the actual name of the attribute
used as the
> unique identifier. How would you find out what it is if it is not
> listed in its describeFeatureType?Well, part of the problem is that the FID has a rule that it must not
change. If you exposed it as a normal property than one
could naively
do an update on that field, and accidentally change the FID, which is
very bad from the perspective of stable references to
features. And if
you want to select something by the primary key then you can
just use an
FID filter.I concede that this is not the best answer, and I agree that
we should
offer users the option to expose their primary key as an
attribute. But
this is the reason we don't expose the primary key as a 'normal'
attribute - it's the best thing we've got for a stable, unique
identifier, and we don't want it getting changed. And thus I
do think
the default should be to keep it hidden so it can't be changed. But
there should be a way for a user to expose that key, but with the
knowledge that it opens that risk (to allow them to do something to
protect themselves, make sure it's non-transaction, ect.). Or there
should be more options to let users define what fid's they want.best regards,
Chris
Chris,
I can see where you're coming from here. Looking at it from a
transactional perspective it does expose a few risks. I didn't know that
you could use an FID filter without knowing the name of the attribute.
Your suggestion sounds good - to have it optionally displayed -
especially for those like myself that use geoserver as a means to
publish basic services on a read-only basis.
Shall I request it on jira?
Many thanks,
Miles
___________________________________________________________________________
Australian Antarctic Division - Commonwealth of Australia
IMPORTANT: This transmission is intended for the addressee only. If you are not the
intended recipient, you are notified that use or dissemination of this communication is
strictly prohibited by Commonwealth law. If you have received this transmission in error,
please notify the sender immediately by e-mail or by telephoning +61 3 6232 3209 and
DELETE the message.
Visit our web site at http://www.aad.gov.au/
___________________________________________________________________________