Skip to content

Instantly share code, notes, and snippets.

@zazi
Created January 11, 2012 19:47
Show Gist options
  • Save zazi/1596413 to your computer and use it in GitHub Desktop.
Save zazi/1596413 to your computer and use it in GitHub Desktop.
A rough Turtle serialisation of the HAL example at https://gist.github.com/572481
@prefix ex: <http://example.com> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
# this is a (partial) list of orders
<> a ex:OrderList ;
ex:next </orders?page=2> ;
ex:search </orders?id={order_id}> ;
ex:order </orders/123> , </orders/124> .
# a single order with the order_id=123
</orders/123>
a ex:Order ;
ex:customer </customer/bob> ;
ex:total "30.00" ;
ex:currency "USD" ;
ex:status "shipped" ;
ex:placed "2011-01-16"^^xsd:date ;
ex:basket </orders/123/basket> .
# the basket of the order 123
</orders/123/basket>
ex:item [
a ex:Item ;
ex:sku "ABC123" ;
ex:quantity 2 ;
ex:price 9.50
] , [
a ex:Item ;
ex:sku "GZU111" ;
ex:quantity 1 ;
ex:price 11
] .
# the customer of order 123
</customer/bob>
ex:Customer ;
ex:name "Bob Jones" ;
exemail "bob@jones.com" .
# a single order with the order_id=124
</orders/124>
a ex:Order ;
ex:customer </customer/jen> ;
ex:total "20.00" ;
ex:currency "USD" ;
ex:status "processing" ;
ex:placed "2011-01-16"^^xsd:date ;
ex:basket </orders/123/basket> .
# the basket of the order 124
</orders/124/basket>
ex:item [
a ex:Item ;
ex:sku "KLM222" ;
ex:quantity 1 ;
ex:price 9.00
] , [
a ex:Item ;
ex:sku "HHI50" ;
ex:quantity 1 ;
ex:prive 11.00
] .
# the customer of order 124
</customer/jen>
ex:Customer ;
ex:name "Jen Harris" ;
exemail "jen@internet.com" .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment