@base <http://localhost:9000/api/schema/>.

@prefix hydra: <http://www.w3.org/ns/hydra/core#>.
@prefix code: <https://code.described.at/>.
@prefix hydrabox: <http://hydra-box.org/schema/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xml: <http://www.w3.org/XML/1998/namespace>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix schema: <http://schema.org/> .

<Blog> a hydra:Class;
  hydra:supportedOperation
    <blog#get>,
    <blog#post>.

<blog#get> a hydra:SupportedOperation;
  hydrabox:variables <blog#search>;
  hydra:expects <TimeRange>;
  hydra:method "GET";
  hydra:returns <Result>;
  code:implementedBy [ a code:EcmaScript;
    code:link <file:./blog.js#get>
  ].

<blog#post> a hydra:SupportedOperation;
  hydra:expects <Post>;
  hydra:method "POST";
  code:implementedBy [ a code:EcmaScript;
    code:link <file:./blog.js#post>
  ].

<blog#search> a hydra:IriTemplate;
  hydra:mapping [ a hydra:IriTemplateMapping;
    hydra:property <from>;
    hydra:variable "from"
  ], [ a hydra:IriTemplateMapping;
    hydra:property <to>;
    hydra:variable "to"
  ], [ a hydra:IriTemplateMapping;
    hydra:property <tag>;
    hydra:variable "tag"
  ];
  hydra:template "/{?from,to,tag}";
  hydra:variableRepresentation hydra:BasicRepresentation .

<Post> a hydra:Class;
  hydra:supportedOperation
    <post#get>;
  hydra:supportedProperty [
    hydra:property <comments>
  ].

<post#get> a hydra:SupportedOperation;
  hydra:method "GET";
  hydra:returns <Post>;
  code:implementedBy [ a code:EcmaScript;
    code:link <file:./post.js#get>
  ].

<comment#post> a hydra:SupportedOperation, schema:CreateAction ;
  hydra:method "POST";
  hydra:title "Post comment" ;
  hydra:expects <Comment>;
  hydra:returns <Post>;
  code:implementedBy [ a code:EcmaScript;
    code:link <file:./comment.js#post>
  ].

<Comment> a hydra:Class.

<Result> a hydra:Class.

<TimeRange> a hydra:Class;
  hydra:supportedProperty [
    hydra:property <from>
  ], [
    hydra:property <to>
  ].

<comments> a hydra:Link;
  hydra:supportedOperation
      <comment#post>.

<Category> a hydra:Class ;
  hydra:supportedOperation
    <category#get>;
  hydra:supportedProperty [
    hydra:property <post>
  ] ;
  hydra:supportedProperty [
    hydra:property <pinned-post>
  ]
.

<category#get> a hydra:SupportedOperation;
  hydra:method "GET";
  hydra:returns <Category>;
  code:implementedBy [ a code:EcmaScript;
                       code:link <file:./category.js#get>
                     ].

<post> a hydra:Link, rdf:Property .

<pinned-post> a hydra:Link, rdf:Property ;
  hydra:supportedOperation [
     hydra:method "PUT" ;
     code:implementedBy "(req, res, next) => res.status(204).end()"^^code:EcmaScript
  ]
.
