Find all buildings having a generic string attribute with the name 'area' and the value '20'

XML Query

<query xmlns="http://www.3dcitydb.org/importer-exporter/config">
  <typeNames>
    <typeName xmlns:bldg="http://www.opengis.net/citygml/building/2.0">bldg:Building</typeName>
  </typeNames>
  <filter>
    <propertyIsEqualTo>
      <valueReference>gen:doubleAttribute[@gen:name="area"]/gen:value</valueReference>
      <literal>20</literal>
    </propertyIsEqualTo>
  </filter>
</query>

SQL Query for 3DCityDB v4 (PostgreSQL)

select
  distinct b.id,
  b.objectclass_id,
  b.gmlid
from
  citydb.cityobject b
  inner join citydb.cityobject_genericattrib c on (
    b.id = c.cityobject_id
    and c.root_genattrib_id = c.id
    --Datatype=3 means it can contain string values, it is not reserved for area values
    --This behaviour changed with v5 property table mechanism.
    --Changed row is below
    --and c.datatype = 3
    --Following conditions has been added.
    and c.attrname = 'Flaeche'  --Flaeche is valid for Berlin dataset
    and round(c.strval::double precision) = 20
  )

SQL Query for 3DCityDB v5 (PostgreSQL)

SELECT 
  ftr.id
  ,ftr.objectclass_id
  ,ftr.gmlid
  --Just to check area values:
  --,pro.val_string
FROM citydb.feature AS ftr
INNER JOIN citydb.property AS pro
  ON ftr.id = pro.feature_id
    AND pro.id = pro.root_id
    AND pro.namespace='gen'
    AND pro.name='Flaeche'
WHERE round(pro.val_string::double precision) = 20;