geo4web-testbed / topic4

1 stars 0 forks source link

Create JSON-LD version of Farmland using Schema.org #9

Closed liekeverhelst closed 8 years ago

liekeverhelst commented 9 years ago

So we have a data schema from the AAN WFS that reads:

<?xml version="1.0" encoding="utf-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:aan="http://aan.geonovum.nl" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wfs="http://www.opengis.net/wfs/2.0" elementFormDefault="qualified" targetNamespace="http://aan.geonovum.nl">
  <xsd:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://geodata.nationaalgeoregister.nl/schemas/gml/3.2.1/gml.xsd"/>
  <xsd:complexType name="aanType">
    <xsd:complexContent>
      <xsd:extension base="gml:AbstractFeatureType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="0" name="objectid" nillable="true" type="xsd:int"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="aanid" nillable="true" type="xsd:int"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="versiebron" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="type" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="geom" nillable="true" type="gml:MultiSurfacePropertyType"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="aan" substitutionGroup="gml:AbstractFeature" type="aan:aanType"/>
</xsd:schema>

In statements we would say that we have an aanType that extends the gml:AbstractFeatureType. This particular type of Feature has datatype properties objectid (integer), aanid (integer) versiebron (string) type (string) and a object property "geo" that relates to a gml:MultiSurfacePropertyType. We also have a first record that reads:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:aan="http://aan.geonovum.nl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberMatched="501103" numberReturned="1" timeStamp="2015-11-18T18:03:55.687Z" xsi:schemaLocation="http://www.opengis.net/gml/3.2 http://geodata.nationaalgeoregister.nl/schemas/gml/3.2.1/gml.xsd http://www.opengis.net/wfs/2.0 http://geodata.nationaalgeoregister.nl/schemas/wfs/2.0/wfs.xsd http://aan.geonovum.nl http://geodata.nationaalgeoregister.nl/aan/wfs?service=WFS&amp;version=2.0.0&amp;request=DescribeFeatureType&amp;typeName=aan%3Aaan">
  <wfs:member>
    <aan:aan gml:id="aan.1">
      <aan:objectid>356490</aan:objectid>
      <aan:aanid>1356489</aan:aanid>
      <aan:versiebron>luchtfoto 2013</aan:versiebron>
      <aan:type>BTR-landbouw</aan:type>
      <aan:geom>
        <gml:MultiSurface srsDimension="2" srsName="urn:ogc:def:crs:EPSG::28992">
          <gml:surfaceMember>
            <gml:Polygon srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#28992">
              <gml:exterior>
                <gml:LinearRing>
                  <gml:posList>111370.8638000004 561886.1823000014 111417.20600000024 561903.2932999991 111470.32140000165 561824.9866999984 111479.94629999995 561811.7969999984 111481.49109999835 561809.3016999997 111452.9728000015 561791.3588999994 111435.50530000031 561780.4268999994 111412.69060000032 561770.9206999987 111404.84809999913 561768.0689000003 111389.99480000138 561764.5040999986 111384.2910999991 561764.1475999989 111368.96249999851 561815.2430000007 111349.47500000149 561878.1020999998 111370.8638000004 561886.1823000014</gml:posList>
                </gml:LinearRing>
              </gml:exterior>
            </gml:Polygon>
          </gml:surfaceMember>
        </gml:MultiSurface>
      </aan:geom>
    </aan:aan>
  </wfs:member>
</wfs:FeatureCollection>

Now we have to convert this to something meaningful that the search engines can read. For this we use the schema.org vocabulary and the JSON-LD RDF serialisation. I have created an image from the most important classes and properties related to geometry that are available in schema.org.

schema-geo v2

Schema.org allows for much freedom in modeling, as can for example be seen from the schema:address property. The range for this property can be either Text or a PostalAddress resource.