Skip to content

Instantly share code, notes, and snippets.

@PjGeeroms
Last active July 6, 2016 20:04
Show Gist options
  • Save PjGeeroms/1ecab069d96d728e04390fe1b115de85 to your computer and use it in GitHub Desktop.
Save PjGeeroms/1ecab069d96d728e04390fe1b115de85 to your computer and use it in GitHub Desktop.
Datex2 Rdfa Parking
<!-- Used prefix: prefix="dtx: http://vocab.datex.org/terms# -->
<article typeof="dtx:ParkingSite" resource="{{app.request.baseUrl}}#parking">
<h2 property="dtx:parkingName">{{data.name}}</h2>
<p property="dtx:parkingSiteAddress">{{data.address}}</p>
<p property="dtx:ParkingLocation">{{data.city}}</p>
<p property="dtx:contactDetailsTelephoneNumber">{{data.telephone}}</p>
<p property="dtx:parkingDescription">{{data.description}}</p>
<p property="dtx:longitude">{{data.longitude}}</p>
<p property="dtx:latitude">{{data.latitude}}</p>
<p>spaces: <span property="dtx:parkingSpaceOccupied">{{data.occupied}}</span>/<span property="dtx:totalCapacity">{{data.maxSpace}}</span></p>
</article>
@pietercolpaert
Copy link

typeof is being used on top of a certain resource. You have to say somelike this in pseudocode/pseudo RDF:

<something> rdf:type dtx:ParkingSite .

The rdf:type is a predicate automatically generated by the rdfa using typeof. The problem is thus that you do have the type, you do have the predicate, but you did not add a subject.

In RDFa, you also have other things you can use, such as property and resource. Property says what is between the tags is a value (so you'll need to use this with things like longitude and latitude. Resource gives a subject to the current tag, so you'll also need this when you're defining a new parking spot.

Do you want me to fork this gist and show you how you could do this better, or do you understand my feedback?

@pietercolpaert
Copy link

I also forgot: classes, or resources that you can put in a typeof="" will thanks to the convention I use, similar to object oriented programming, will always have a capital in the beginning, while predicates will always have a small letter at the beginning of the word.

@pietercolpaert
Copy link

I tried to do something more with it. Comments left in the file: https://gist.github.com/pietercolpaert/6470b51ebc9ebe66f91615cc8d6964f2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment