Skip to content

Instantly share code, notes, and snippets.

@ericmoritz
Last active August 29, 2015 13:56
Show Gist options
  • Save ericmoritz/9165391 to your computer and use it in GitHub Desktop.
Save ericmoritz/9165391 to your computer and use it in GitHub Desktop.
Sample RDF data
*~
.venv/
build/
src/
from rdflib import Graph
import sys
in_uri = sys.argv[1]
in_format = sys.argv[2]
out_format = sys.argv[3]
if __name__ == '__main__':
print Graph().parse(in_uri, format=in_format).serialize(format=out_format),
"""
This is an example of consuming an RDF graph using Python.
It is quite simple because we can use SPARQL with rdflib
"""
from rdflib import Graph
from rdflib_jsonld.parser import to_rdf
import json
from pprint import pprint
import requests
def query_collection(g):
r = g.query("""
PREFIX meme: <http://memegenerator.net/vocab/meme#>
PREFIX schema: <http://schema.org/>
PREFIX hydra: <http://www.w3.org/ns/hydra/core#>
SELECT ?id
WHERE {
?members hydra:members ?id
}""")
return list(r)
def all_meme_collection(g):
"""
Return a Hydra collection in JSON-LD of all meme:Meme objects in the graph.
"""
r = g.query("""
PREFIX meme: <http://memegenerator.net/vocab/meme#>
PREFIX schema: <http://schema.org/>
SELECT ?id ?image ?bottomText ?topText
WHERE {
?id rdf:type meme:Meme ;
schema:image ?image ;
meme:topText ?topText ;
meme:bottomText ?bottomText .
}""")
return {
"@context": {
"hydra": "http://www.w3.org/ns/hydra/core#",
"members": "hydra:members",
},
"@id": "memeListing",
"@type": "hydra:Collection",
"members": [
{
"@context": {
"schema": "http://schema.org/",
"meme": "http://memegenerator.net/vocab/meme#",
"image": "schema:image",
"topText": "meme:topText",
"bottomText": "meme:bottomText"
},
"@type": "meme:Meme",
"@id": str(iri),
"image": str(image),
"topText": str(topText),
"bottomText": str(bottomText)
}
for iri, image, topText, bottomText in r
]
}
# Create a graph from the meme.html microdata
g = Graph().parse("./meme.html", format="microdata")
# extract all the memes on the page
collection = all_meme_collection(g)
pprint(collection)
{
"@context": {
"hydra": "http://www.w3.org/ns/hydra/core#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"owl": "http://www.w3.org/2002/07/owl#",
"vs": "http://www.w3.org/2003/06/sw-vocab-status/ns#",
"apiDocumentation": "hydra:apiDocumentation",
"ApiDocumentation": "hydra:ApiDocumentation",
"title": "hydra:title",
"description": "hydra:description",
"entrypoint": { "@id": "hydra:entrypoint", "@type": "@id" },
"supportedClass": { "@id": "hydra:supportedClass", "@type": "@id" },
"Class": "hydra:Class",
"supportedProperty": { "@id": "hydra:supportedProperty", "@type": "@id" },
"SupportedProperty": "hydra:SupportedProperty",
"property": { "@id": "hydra:property", "@type": "@id" },
"required": "hydra:required",
"readonly": "hydra:readonly",
"writeonly": "hydra:writeonly",
"supportedOperation": { "@id": "hydra:supportedOperation", "@type": "@id" },
"Operation": "hydra:Operation",
"CreateResourceOperation": "hydra:CreateResourceOperation",
"ReplaceResourceOperation": "hydra:ReplaceResourceOperation",
"DeleteResourceOperation": "hydra:DeleteResourceOperation",
"method": "hydra:method",
"expects": { "@id": "hydra:expects", "@type": "@id" },
"returns": { "@id": "hydra:returns", "@type": "@id" },
"statusCodes": { "@id": "hydra:statusCodes", "@type": "@id" },
"StatusCodeDescription": "hydra:StatusCodeDescription",
"statusCode": "hydra:statusCode",
"Error": "hydra:Error",
"Resource": "hydra:Resource",
"operation": "hydra:operation",
"Collection": "hydra:Collection",
"member": { "@id": "hydra:member", "@type": "@id" },
"search": "hydra:search",
"freetextQuery": "hydra:freetextQuery",
"PagedCollection": "hydra:PagedCollection",
"totalItems": "hydra:totalItems",
"itemsPerPage": "hydra:itemsPerPage",
"firstPage": { "@id": "hydra:firstPage", "@type": "@id" },
"lastPage": { "@id": "hydra:lastPage", "@type": "@id" },
"nextPage": { "@id": "hydra:nextPage", "@type": "@id" },
"previousPage": { "@id": "hydra:previousPage", "@type": "@id" },
"Link": "hydra:Link",
"TemplatedLink": "hydra:TemplatedLink",
"IriTemplate": "hydra:IriTemplate",
"template": "hydra:template",
"mapping": "hydra:mapping",
"IriTemplateMapping": "hydra:IriTemplateMapping",
"variable": "hydra:variable",
"defines": { "@reverse": "rdfs:isDefinedBy" },
"comment": "rdfs:comment",
"label": "rdfs:label",
"domain": { "@id": "rdfs:domain", "@type": "@id" },
"range": {"@id": "rdfs:range", "@type": "@id" },
"subClassOf": { "@id": "rdfs:subClassOf", "@type": "@id" },
"subPropertyOf": { "@id": "rdfs:subPropertyOf", "@type": "@id" },
"seeAlso": { "@id": "rdfs:seeAlso", "@type": "@id" }
},
"@id": "http://www.w3.org/ns/hydra/core",
"@type": "owl:Ontology",
"label": "The Hydra Core Vocabulary",
"comment": "A lightweight vocabulary for hypermedia-driven Web APIs",
"defines": [
{
"@id": "hydra:Resource",
"@type": "hydra:Class",
"subClassOf": "rdfs:Resource",
"label": "Hydra Resource",
"comment": "The class of dereferenceable resources.",
"vs:term_status": "stable"
},
{
"@id": "hydra:Class",
"@type": [ "hydra:Resource", "rdfs:Class" ],
"subClassOf": [ "hydra:Resource", "rdfs:Class" ],
"label": "Hydra Class",
"comment": "The class of Hydra classes. Hydra classes and their instances are dereferenceable resources.",
"vs:term_status": "stable"
},
{
"@id": "hydra:Link",
"@type": "hydra:Class",
"subClassOf": [ "hydra:Resource", "rdf:Property" ],
"label": "Link",
"comment": "The class of properties representing links.",
"vs:term_status": "stable"
},
{
"@id": "hydra:apiDocumentation",
"@type": "hydra:Link",
"label": "apiDocumentation",
"comment": "A link to the API documentation",
"range": "hydra:ApiDocumentation",
"vs:term_status": "stable"
},
{
"@id": "hydra:ApiDocumentation",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "ApiDocumentation",
"comment": "The Hydra API documentation class",
"vs:term_status": "stable"
},
{
"@id": "hydra:entrypoint",
"@type": "hydra:Link",
"label": "entrypoint",
"comment": "A link to main entry point of the Web API",
"domain": "hydra:ApiDocumentation",
"range": "hydra:Resource",
"vs:term_status": "stable"
},
{
"@id": "hydra:supportedClass",
"@type": "hydra:Link",
"label": "supported classes",
"comment": "A class known to be supported by the Web API",
"domain": "hydra:ApiDocumentation",
"range": "hydra:Class",
"vs:term_status": "stable"
},
{
"@id": "hydra:statusCodes",
"@type": "hydra:Link",
"label": "status codes",
"comment": "Additional information about status codes that might be returned by the Web API",
"range": "hydra:StatusCodeDescription",
"vs:term_status": "stable"
},
{
"@id": "hydra:supportedProperty",
"@type": "hydra:Link",
"label": "supported properties",
"comment": "The properties known to be supported by a Hydra class",
"domain": "hydra:Class",
"range": "hydra:SupportedProperty",
"vs:term_status": "stable"
},
{
"@id": "hydra:SupportedProperty",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "Supported Property",
"comment": "A property known to be supported by a Hydra class.",
"vs:term_status": "stable"
},
{
"@id": "hydra:property",
"@type": "rdf:Property",
"label": "property",
"comment": "A property",
"range": "rdf:Property",
"vs:term_status": "stable"
},
{
"@id": "hydra:required",
"@type": "rdf:Property",
"label": "required",
"comment": "True if the property is required, false otherwise.",
"range": "xsd:boolean",
"vs:term_status": "stable"
},
{
"@id": "hydra:readonly",
"@type": "rdf:Property",
"label": "ready-only",
"comment": "True if the property is read-only, false otherwise.",
"domain": "hydra:SupportedProperty",
"range": "xsd:boolean",
"vs:term_status": "stable"
},
{
"@id": "hydra:writeonly",
"@type": "rdf:Property",
"label": "write-only",
"comment": "True if the property is write-only, false otherwise.",
"domain": "hydra:SupportedProperty",
"range": "xsd:boolean",
"vs:term_status": "stable"
},
{
"@id": "hydra:supportedOperation",
"@type": "hydra:Link",
"label": "supported operation",
"comment": "An operation supported by instances of the specific Hydra class or the target of the Hydra link",
"range": "hydra:Operation",
"vs:term_status": "stable"
},
{
"@id": "hydra:operation",
"@type": "hydra:Link",
"label": "operation",
"comment": "An operation supported by the Hydra resource",
"domain": "hydra:Resource",
"range": "hydra:Operation",
"vs:term_status": "stable"
},
{
"@id": "hydra:Operation",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "Operation",
"comment": "An operation.",
"vs:term_status": "stable"
},
{
"@id": "hydra:CreateResourceOperation",
"@type": "hydra:Class",
"subClassOf": "hydra:Operation",
"label": "CreateResourceOperation",
"comment": "A CreateResourceOperation is a HTTP operation which expects an input of the type specified by hydra:expects and creates a resource of the type specified by hydra:returns.",
"vs:term_status": "testing"
},
{
"@id": "hydra:ReplaceResourceOperation",
"@type": "hydra:Class",
"subClassOf": "hydra:Operation",
"label": "ReplaceResourceOperation",
"comment": "A ReplaceResourceOperation is a HTTP operation which overwrites a resource. It data of the type specified in hydra:expects and results in a resource of the type specified by hydra:returns.",
"vs:term_status": "testing"
},
{
"@id": "hydra:DeleteResourceOperation",
"@type": "hydra:Class",
"subClassOf": "hydra:Operation",
"label": "DeleteResourceOperation",
"comment": "A DeleteResourceOperation is a HTTP operation that deletes a resource.",
"vs:term_status": "testing"
},
{
"@id": "hydra:method",
"@type": "rdf:Property",
"label": "method",
"comment": "The HTTP method.",
"domain": "hydra:Operation",
"range": "xsd:string",
"vs:term_status": "stable"
},
{
"@id": "hydra:expects",
"@type": "hydra:Link",
"label": "expects",
"comment": "The information expected by the Web API.",
"domain": "hydra:Operation",
"range": "hydra:Class",
"vs:term_status": "stable"
},
{
"@id": "hydra:returns",
"@type": "hydra:Link",
"label": "returns",
"comment": "The information returned by the Web API on success",
"domain": "hydra:Operation",
"range": "hydra:Class",
"vs:term_status": "stable"
},
{
"@id": "hydra:StatusCodeDescription",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "Status code description",
"comment": "Additional information about a status code that might be returned.",
"vs:term_status": "stable"
},
{
"@id": "hydra:statusCode",
"@type": "rdf:Property",
"label": "status code",
"comment": "The HTTP status code",
"domain": "hydra:StatusCodeDescription",
"range": "xsd:integer",
"vs:term_status": "stable"
},
{
"@id": "hydra:title",
"@type": "rdf:Property",
"subPropertyOf": "rdfs:label",
"label": "title",
"comment": "A title, often used along with a description.",
"range": "xsd:string",
"vs:term_status": "testing"
},
{
"@id": "hydra:description",
"@type": "rdf:Property",
"subPropertyOf": "rdfs:comment",
"label": "description",
"comment": "A description.",
"range": "xsd:string",
"vs:term_status": "testing"
},
{
"@id": "hydra:Error",
"@type": "hydra:Class",
"subClassOf": "hydra:StatusCodeDescription",
"label": "Error",
"comment": "A runtime error, used to report information beyond the returned status code.",
"vs:term_status": "stable"
},
{
"@id": "hydra:Collection",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "Collection",
"comment": "A collection holding references to a number of related resources.",
"vs:term_status": "testing"
},
{
"@id": "hydra:member",
"@type": "hydra:Link",
"label": "member",
"comment": "A member of the collection",
"domain": "hydra:Collection",
"range": "hydra:Resource",
"vs:term_status": "testing"
},
{
"@id": "hydra:PagedCollection",
"@type": "hydra:Class",
"subClassOf": "hydra:Collection",
"label": "PagedCollection",
"comment": "A PagedCollection is a subclass of Collection with the only difference that its members are sorted and only a subset of all members are returned in a single PagedCollection. To get the other members, the nextPage/previousPage properties have to be used.",
"vs:term_status": "testing"
},
{
"@id": "hydra:totalItems",
"@type": "rdf:Property",
"label": "total items",
"comment": "The total number of items referenced by a collection or a set of interlinked PagedCollections.",
"domain": "hydra:Collection",
"range": "xsd:integer",
"vs:term_status": "testing"
},
{
"@id": "hydra:itemsPerPage",
"@type": "rdf:Property",
"label": "items per page",
"comment": "The maximum number of items referenced by each single PagedCollection in a set of interlinked PagedCollections.",
"domain": "hydra:PagedCollection",
"range": "xsd:integer",
"vs:term_status": "testing"
},
{
"@id": "hydra:firstPage",
"@type": "hydra:Link",
"label": "first page",
"comment": "The first page of an interlinked set of PagedCollections",
"domain": "hydra:PagedCollection",
"range": "hydra:PagedCollection",
"vs:term_status": "testing"
},
{
"@id": "hydra:lastPage",
"@type": "hydra:Link",
"label": "last page",
"comment": "The last page of an interlinked set of PagedCollections",
"domain": "hydra:PagedCollection",
"range": "hydra:PagedCollection",
"vs:term_status": "testing"
},
{
"@id": "hydra:nextPage",
"@type": "hydra:Link",
"label": "next page",
"comment": "The page following the current instance in an interlinked set of PagedCollections",
"domain": "hydra:PagedCollection",
"range": "hydra:PagedCollection",
"vs:term_status": "testing"
},
{
"@id": "hydra:previousPage",
"@type": "hydra:Link",
"label": "previous page",
"comment": "The page preceding the current instance in an interlinked set of PagedCollections",
"domain": "hydra:PagedCollection",
"range": "hydra:PagedCollection",
"vs:term_status": "testing"
},
{
"@id": "hydra:search",
"@type": "hydra:TemplatedLink",
"label": "search",
"comment": "A IRI template that can be used to query a collection",
"range": "hydra:IriTemplate",
"vs:term_status": "testing"
},
{
"@id": "hydra:freetextQuery",
"@type": "rdf:Property",
"label": "freetext query",
"comment": "A property representing a freetext query.",
"range": "xsd:string",
"vs:term_status": "testing"
},
{
"@id": "hydra:TemplatedLink",
"@type": "hydra:Class",
"subClassOf": [ "hydra:Resource", "rdf:Property" ],
"label": "Templated Link",
"comment": "A templated link.",
"vs:term_status": "testing"
},
{
"@id": "hydra:IriTemplate",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "IRI Template",
"comment": "The class of IRI templates.",
"vs:term_status": "testing"
},
{
"@id": "hydra:template",
"@type": "rdf:Property",
"label": "template",
"comment": "An IRI template as defined by RFC6570.",
"seeAlso": "http://tools.ietf.org/html/rfc6570",
"domain": "hydra:IriTemplate",
"range": "xsd:string",
"vs:term_status": "testing"
},
{
"@id": "hydra:mapping",
"@type": "rdf:Property",
"label": "mapping",
"comment": "A variable-to-property mapping of the IRI template.",
"domain": "hydra:IriTemplate",
"range": "hydra:IriTemplateMapping",
"vs:term_status": "testing"
},
{
"@id": "hydra:IriTemplateMapping",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "IriTemplateMapping",
"comment": "A mapping from an IRI template variable to a property.",
"vs:term_status": "testing"
},
{
"@id": "hydra:variable",
"@type": "rdf:Property",
"label": "variable",
"comment": "An IRI template variable",
"domain": "hydra:IriTemplateMapping",
"range": "xsd:string",
"vs:term_status": "testing"
}
]
}
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:vs="http://www.w3.org/2003/06/sw-vocab-status/ns#"
>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#readonly">
<vs:term_status>stable</vs:term_status>
<rdfs:label>ready-only</rdfs:label>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:comment>True if the property is read-only, false otherwise.</rdfs:comment>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#SupportedProperty"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#entrypoint">
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<rdfs:label>entrypoint</rdfs:label>
<vs:term_status>stable</vs:term_status>
<rdfs:comment>A link to main entry point of the Web API</rdfs:comment>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#ApiDocumentation"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#freetextQuery">
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<vs:term_status>testing</vs:term_status>
<rdfs:label>freetext query</rdfs:label>
<rdfs:comment>A property representing a freetext query.</rdfs:comment>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#StatusCodeDescription">
<vs:term_status>stable</vs:term_status>
<rdfs:comment>Additional information about a status code that might be returned.</rdfs:comment>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:label>Status code description</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#totalItems">
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#Collection"/>
<rdfs:comment>The total number of items referenced by a collection or a set of interlinked PagedCollections.</rdfs:comment>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
<rdfs:label>total items</rdfs:label>
<vs:term_status>testing</vs:term_status>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#lastPage">
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
<rdfs:comment>The last page of an interlinked set of PagedCollections</rdfs:comment>
<vs:term_status>testing</vs:term_status>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#PagedCollection"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#PagedCollection"/>
<rdfs:label>last page</rdfs:label>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#supportedClass">
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:comment>A class known to be supported by the Web API</rdfs:comment>
<vs:term_status>stable</vs:term_status>
<rdfs:label>supported classes</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#ApiDocumentation"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#property">
<rdfs:comment>A property</rdfs:comment>
<rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:label>property</rdfs:label>
<vs:term_status>stable</vs:term_status>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#PagedCollection">
<vs:term_status>testing</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Collection"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:label>PagedCollection</rdfs:label>
<rdfs:comment>A PagedCollection is a subclass of Collection with the only difference that its members are sorted and only a subset of all members are returned in a single PagedCollection. To get the other members, the nextPage/previousPage properties have to be used.</rdfs:comment>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#Class">
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<rdfs:label>Hydra Class</rdfs:label>
<rdfs:subClassOf rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<vs:term_status>stable</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:comment>The class of Hydra classes. Hydra classes and their instances are dereferenceable resources.</rdfs:comment>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#SupportedProperty">
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<vs:term_status>stable</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:comment>A property known to be supported by a Hydra class.</rdfs:comment>
<rdfs:label>Supported Property</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#statusCode">
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#StatusCodeDescription"/>
<rdfs:comment>The HTTP status code</rdfs:comment>
<vs:term_status>stable</vs:term_status>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
<rdfs:label>status code</rdfs:label>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#Error">
<rdfs:label>Error</rdfs:label>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#StatusCodeDescription"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:comment>A runtime error, used to report information beyond the returned status code.</rdfs:comment>
<vs:term_status>stable</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#Link">
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<vs:term_status>stable</vs:term_status>
<rdfs:comment>The class of properties representing links.</rdfs:comment>
<rdfs:label>Link</rdfs:label>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#operation">
<vs:term_status>stable</vs:term_status>
<rdfs:comment>An operation supported by the Hydra resource</rdfs:comment>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#Operation"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
<rdfs:label>operation</rdfs:label>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#template">
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:comment>An IRI template as defined by RFC6570.</rdfs:comment>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#IriTemplate"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:label>template</rdfs:label>
<vs:term_status>testing</vs:term_status>
<rdfs:seeAlso rdf:resource="http://tools.ietf.org/html/rfc6570"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#method">
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:comment>The HTTP method.</rdfs:comment>
<vs:term_status>stable</vs:term_status>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:label>method</rdfs:label>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#Operation"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#statusCodes">
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
<rdfs:comment>Additional information about status codes that might be returned by the Web API</rdfs:comment>
<vs:term_status>stable</vs:term_status>
<rdfs:label>status codes</rdfs:label>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#StatusCodeDescription"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#Operation">
<rdfs:label>Operation</rdfs:label>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:comment>An operation.</rdfs:comment>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<vs:term_status>stable</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#previousPage">
<rdfs:label>previous page</rdfs:label>
<rdfs:comment>The page preceding the current instance in an interlinked set of PagedCollections</rdfs:comment>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#PagedCollection"/>
<vs:term_status>testing</vs:term_status>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#PagedCollection"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#IriTemplate">
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<vs:term_status>testing</vs:term_status>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<rdfs:label>IRI Template</rdfs:label>
<rdfs:comment>The class of IRI templates.</rdfs:comment>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#expects">
<vs:term_status>stable</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#Operation"/>
<rdfs:label>expects</rdfs:label>
<rdfs:comment>The information expected by the Web API.</rdfs:comment>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#CreateResourceOperation">
<rdfs:label>CreateResourceOperation</rdfs:label>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Operation"/>
<vs:term_status>testing</vs:term_status>
<rdfs:comment>A CreateResourceOperation is a HTTP operation which expects an input of the type specified by hydra:expects and creates a resource of the type specified by hydra:returns.</rdfs:comment>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#title">
<rdfs:label>title</rdfs:label>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<vs:term_status>testing</vs:term_status>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:subPropertyOf rdf:resource="http://www.w3.org/2000/01/rdf-schema#label"/>
<rdfs:comment>A title, often used along with a description.</rdfs:comment>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#DeleteResourceOperation">
<rdfs:comment>A DeleteResourceOperation is a HTTP operation that deletes a resource.</rdfs:comment>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Operation"/>
<vs:term_status>testing</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:label>DeleteResourceOperation</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#TemplatedLink">
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<rdfs:comment>A templated link.</rdfs:comment>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<vs:term_status>testing</vs:term_status>
<rdfs:label>Templated Link</rdfs:label>
<rdfs:subClassOf rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#mapping">
<rdfs:comment>A variable-to-property mapping of the IRI template.</rdfs:comment>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#IriTemplateMapping"/>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:label>mapping</rdfs:label>
<vs:term_status>testing</vs:term_status>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#IriTemplate"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#required">
<rdfs:comment>True if the property is required, false otherwise.</rdfs:comment>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<vs:term_status>stable</vs:term_status>
<rdfs:label>required</rdfs:label>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#firstPage">
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:label>first page</rdfs:label>
<rdfs:comment>The first page of an interlinked set of PagedCollections</rdfs:comment>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#PagedCollection"/>
<vs:term_status>testing</vs:term_status>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#PagedCollection"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#member">
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#Collection"/>
<vs:term_status>testing</vs:term_status>
<rdfs:comment>A member of the collection</rdfs:comment>
<rdfs:label>member</rdfs:label>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#supportedOperation">
<rdfs:label>supported operation</rdfs:label>
<vs:term_status>stable</vs:term_status>
<rdfs:comment>An operation supported by instances of the specific Hydra class or the target of the Hydra link</rdfs:comment>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#Operation"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#Collection">
<vs:term_status>testing</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:comment>A collection holding references to a number of related resources.</rdfs:comment>
<rdfs:label>Collection</rdfs:label>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#nextPage">
<rdfs:comment>The page following the current instance in an interlinked set of PagedCollections</rdfs:comment>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#PagedCollection"/>
<rdfs:label>next page</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#PagedCollection"/>
<vs:term_status>testing</vs:term_status>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#ReplaceResourceOperation">
<rdfs:label>ReplaceResourceOperation</rdfs:label>
<rdfs:comment>A ReplaceResourceOperation is a HTTP operation which overwrites a resource. It data of the type specified in hydra:expects and results in a resource of the type specified by hydra:returns.</rdfs:comment>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Operation"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<vs:term_status>testing</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#Resource">
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:label>Hydra Resource</rdfs:label>
<rdfs:comment>The class of dereferenceable resources.</rdfs:comment>
<vs:term_status>stable</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#returns">
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#Operation"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
<rdfs:label>returns</rdfs:label>
<rdfs:comment>The information returned by the Web API on success</rdfs:comment>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<vs:term_status>stable</vs:term_status>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#description">
<rdfs:label>description</rdfs:label>
<rdfs:subPropertyOf rdf:resource="http://www.w3.org/2000/01/rdf-schema#comment"/>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<vs:term_status>testing</vs:term_status>
<rdfs:comment>A description.</rdfs:comment>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#apiDocumentation">
<vs:term_status>stable</vs:term_status>
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#ApiDocumentation"/>
<rdfs:label>apiDocumentation</rdfs:label>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:comment>A link to the API documentation</rdfs:comment>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#itemsPerPage">
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#PagedCollection"/>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:comment>The maximum number of items referenced by each single PagedCollection in a set of interlinked PagedCollections.</rdfs:comment>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
<rdfs:label>items per page</rdfs:label>
<vs:term_status>testing</vs:term_status>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#writeonly">
<rdfs:comment>True if the property is write-only, false otherwise.</rdfs:comment>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<vs:term_status>stable</vs:term_status>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#SupportedProperty"/>
<rdfs:label>write-only</rdfs:label>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#variable">
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#IriTemplateMapping"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:comment>An IRI template variable</rdfs:comment>
<vs:term_status>testing</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:label>variable</rdfs:label>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core">
<rdfs:comment>A lightweight vocabulary for hypermedia-driven Web APIs</rdfs:comment>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
<rdfs:label>The Hydra Core Vocabulary</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#supportedProperty">
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#SupportedProperty"/>
<rdfs:domain rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<rdfs:comment>The properties known to be supported by a Hydra class</rdfs:comment>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Link"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<vs:term_status>stable</vs:term_status>
<rdfs:label>supported properties</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#search">
<rdfs:range rdf:resource="http://www.w3.org/ns/hydra/core#IriTemplate"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#TemplatedLink"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:comment>A IRI template that can be used to query a collection</rdfs:comment>
<rdfs:label>search</rdfs:label>
<vs:term_status>testing</vs:term_status>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#IriTemplateMapping">
<rdfs:comment>A mapping from an IRI template variable to a property.</rdfs:comment>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
<vs:term_status>testing</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:label>IriTemplateMapping</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about="http://www.w3.org/ns/hydra/core#ApiDocumentation">
<rdfs:label>ApiDocumentation</rdfs:label>
<rdfs:comment>The Hydra API documentation class</rdfs:comment>
<vs:term_status>stable</vs:term_status>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/ns/hydra/core"/>
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/hydra/core#Resource"/>
<rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Class"/>
</rdf:Description>
</rdf:RDF>
<?doctype html>
<html>
<body>
<div
itemscope
itemtype="http://memegenerator.net/vocab/meme#Meme"
itemid="http://memegenerator.net/instance/46341004"
>
<a itemprop="http://schema.org/url"
href="http://memegenerator.net/instance/46341004">
<img itemprop="http://schema.org/image"
src="http://cdn.memegenerator.net/instances/46341004.jpg" />
</a>
</div>
<div
itemscope
itemtype="http://memegenerator.net/vocab/meme#Meme"
itemid="http://memegenerator.net/instance/46341004">
<h2>Meme Text:</h2>
<div
itemprop="http://memegenerator.net/vocab/meme#topText">You GET AN IRI, You GET AN IRI</div>
<div
itemprop="http://memegenerator.net/vocab/meme#bottomText">EVERYONE GETS AN IRI!!!!</div>
</div>
</body>
</html>
{
"@context": {
"meme": "http://memegenerator.net/vocab/meme#",
"schema": "http://schema.org/",
"html_url": "schema:url",
"image_url": "schema:image",
"bottom": "meme:bottomText",
"top": "meme:topText"
},
"@id": "http://memegenerator.net/instance/46341004",
"html_url": "http://memegenerator.net/instance/46341004",
"image_url": "http://cdn.memegenerator.net/instances/46341004.jpg",
"bottom": "EVERYONE GETS AN IRI!!!!",
"top": "You GET AN IRI, You GET AN IRI"
}
{
"@context": {
"hydra": "http://www.w3.org/ns/hydra/core#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"owl": "http://www.w3.org/2002/07/owl#",
"vs": "http://www.w3.org/2003/06/sw-vocab-status/ns#",
"apiDocumentation": "hydra:apiDocumentation",
"ApiDocumentation": "hydra:ApiDocumentation",
"title": "hydra:title",
"description": "hydra:description",
"entrypoint": { "@id": "hydra:entrypoint", "@type": "@id" },
"supportedClass": { "@id": "hydra:supportedClass", "@type": "@id" },
"Class": "hydra:Class",
"supportedProperty": { "@id": "hydra:supportedProperty", "@type": "@id" },
"SupportedProperty": "hydra:SupportedProperty",
"property": { "@id": "hydra:property", "@type": "@id" },
"required": "hydra:required",
"readonly": "hydra:readonly",
"writeonly": "hydra:writeonly",
"supportedOperation": { "@id": "hydra:supportedOperation", "@type": "@id" },
"Operation": "hydra:Operation",
"CreateResourceOperation": "hydra:CreateResourceOperation",
"ReplaceResourceOperation": "hydra:ReplaceResourceOperation",
"DeleteResourceOperation": "hydra:DeleteResourceOperation",
"method": "hydra:method",
"expects": { "@id": "hydra:expects", "@type": "@id" },
"returns": { "@id": "hydra:returns", "@type": "@id" },
"statusCodes": { "@id": "hydra:statusCodes", "@type": "@id" },
"StatusCodeDescription": "hydra:StatusCodeDescription",
"statusCode": "hydra:statusCode",
"Error": "hydra:Error",
"Resource": "hydra:Resource",
"operation": "hydra:operation",
"Collection": "hydra:Collection",
"member": { "@id": "hydra:member", "@type": "@id" },
"search": "hydra:search",
"freetextQuery": "hydra:freetextQuery",
"PagedCollection": "hydra:PagedCollection",
"totalItems": "hydra:totalItems",
"itemsPerPage": "hydra:itemsPerPage",
"firstPage": { "@id": "hydra:firstPage", "@type": "@id" },
"lastPage": { "@id": "hydra:lastPage", "@type": "@id" },
"nextPage": { "@id": "hydra:nextPage", "@type": "@id" },
"previousPage": { "@id": "hydra:previousPage", "@type": "@id" },
"Link": "hydra:Link",
"TemplatedLink": "hydra:TemplatedLink",
"IriTemplate": "hydra:IriTemplate",
"template": "hydra:template",
"mapping": "hydra:mapping",
"IriTemplateMapping": "hydra:IriTemplateMapping",
"variable": "hydra:variable",
"defines": { "@reverse": "rdfs:isDefinedBy" },
"comment": "rdfs:comment",
"label": "rdfs:label",
"domain": { "@id": "rdfs:domain", "@type": "@id" },
"range": {"@id": "rdfs:range", "@type": "@id" },
"subClassOf": { "@id": "rdfs:subClassOf", "@type": "@id" },
"subPropertyOf": { "@id": "rdfs:subPropertyOf", "@type": "@id" },
"seeAlso": { "@id": "rdfs:seeAlso", "@type": "@id" },
"meme": "http://memesearch.com/vocab/meme#",
"recent": "meme:hasRecentMemeCollection",
"searchLink": "meme:searchLink",
"homepage": {"@id": "xhtml:top", "@type": "@id"}
},
"@id": "http://www.w3.org/ns/hydra/core",
"@type": "owl:Ontology",
"label": "The Hydra Core Vocabulary",
"comment": "A lightweight vocabulary for hypermedia-driven Web APIs",
"defines": [
{
"@id": "hydra:Resource",
"@type": "hydra:Class",
"subClassOf": "rdfs:Resource",
"label": "Hydra Resource",
"comment": "The class of dereferenceable resources.",
"vs:term_status": "stable"
},
{
"@id": "hydra:Class",
"@type": [ "hydra:Resource", "rdfs:Class" ],
"subClassOf": [ "hydra:Resource", "rdfs:Class" ],
"label": "Hydra Class",
"comment": "The class of Hydra classes. Hydra classes and their instances are dereferenceable resources.",
"vs:term_status": "stable"
},
{
"@id": "hydra:Link",
"@type": "hydra:Class",
"subClassOf": [ "hydra:Resource", "rdf:Property" ],
"label": "Link",
"comment": "The class of properties representing links.",
"vs:term_status": "stable"
},
{
"@id": "hydra:apiDocumentation",
"@type": "hydra:Link",
"label": "apiDocumentation",
"comment": "A link to the API documentation",
"range": "hydra:ApiDocumentation",
"vs:term_status": "stable"
},
{
"@id": "hydra:ApiDocumentation",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "ApiDocumentation",
"comment": "The Hydra API documentation class",
"vs:term_status": "stable"
},
{
"@id": "hydra:entrypoint",
"@type": "hydra:Link",
"label": "entrypoint",
"comment": "A link to main entry point of the Web API",
"domain": "hydra:ApiDocumentation",
"range": "hydra:Resource",
"vs:term_status": "stable"
},
{
"@id": "hydra:supportedClass",
"@type": "hydra:Link",
"label": "supported classes",
"comment": "A class known to be supported by the Web API",
"domain": "hydra:ApiDocumentation",
"range": "hydra:Class",
"vs:term_status": "stable"
},
{
"@id": "hydra:statusCodes",
"@type": "hydra:Link",
"label": "status codes",
"comment": "Additional information about status codes that might be returned by the Web API",
"range": "hydra:StatusCodeDescription",
"vs:term_status": "stable"
},
{
"@id": "hydra:supportedProperty",
"@type": "hydra:Link",
"label": "supported properties",
"comment": "The properties known to be supported by a Hydra class",
"domain": "hydra:Class",
"range": "hydra:SupportedProperty",
"vs:term_status": "stable"
},
{
"@id": "hydra:SupportedProperty",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "Supported Property",
"comment": "A property known to be supported by a Hydra class.",
"vs:term_status": "stable"
},
{
"@id": "hydra:property",
"@type": "rdf:Property",
"label": "property",
"comment": "A property",
"range": "rdf:Property",
"vs:term_status": "stable"
},
{
"@id": "hydra:required",
"@type": "rdf:Property",
"label": "required",
"comment": "True if the property is required, false otherwise.",
"range": "xsd:boolean",
"vs:term_status": "stable"
},
{
"@id": "hydra:readonly",
"@type": "rdf:Property",
"label": "ready-only",
"comment": "True if the property is read-only, false otherwise.",
"domain": "hydra:SupportedProperty",
"range": "xsd:boolean",
"vs:term_status": "stable"
},
{
"@id": "hydra:writeonly",
"@type": "rdf:Property",
"label": "write-only",
"comment": "True if the property is write-only, false otherwise.",
"domain": "hydra:SupportedProperty",
"range": "xsd:boolean",
"vs:term_status": "stable"
},
{
"@id": "hydra:supportedOperation",
"@type": "hydra:Link",
"label": "supported operation",
"comment": "An operation supported by instances of the specific Hydra class or the target of the Hydra link",
"range": "hydra:Operation",
"vs:term_status": "stable"
},
{
"@id": "hydra:operation",
"@type": "hydra:Link",
"label": "operation",
"comment": "An operation supported by the Hydra resource",
"domain": "hydra:Resource",
"range": "hydra:Operation",
"vs:term_status": "stable"
},
{
"@id": "hydra:Operation",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "Operation",
"comment": "An operation.",
"vs:term_status": "stable"
},
{
"@id": "hydra:CreateResourceOperation",
"@type": "hydra:Class",
"subClassOf": "hydra:Operation",
"label": "CreateResourceOperation",
"comment": "A CreateResourceOperation is a HTTP operation which expects an input of the type specified by hydra:expects and creates a resource of the type specified by hydra:returns.",
"vs:term_status": "testing"
},
{
"@id": "hydra:ReplaceResourceOperation",
"@type": "hydra:Class",
"subClassOf": "hydra:Operation",
"label": "ReplaceResourceOperation",
"comment": "A ReplaceResourceOperation is a HTTP operation which overwrites a resource. It data of the type specified in hydra:expects and results in a resource of the type specified by hydra:returns.",
"vs:term_status": "testing"
},
{
"@id": "hydra:DeleteResourceOperation",
"@type": "hydra:Class",
"subClassOf": "hydra:Operation",
"label": "DeleteResourceOperation",
"comment": "A DeleteResourceOperation is a HTTP operation that deletes a resource.",
"vs:term_status": "testing"
},
{
"@id": "hydra:method",
"@type": "rdf:Property",
"label": "method",
"comment": "The HTTP method.",
"domain": "hydra:Operation",
"range": "xsd:string",
"vs:term_status": "stable"
},
{
"@id": "hydra:expects",
"@type": "hydra:Link",
"label": "expects",
"comment": "The information expected by the Web API.",
"domain": "hydra:Operation",
"range": "hydra:Class",
"vs:term_status": "stable"
},
{
"@id": "hydra:returns",
"@type": "hydra:Link",
"label": "returns",
"comment": "The information returned by the Web API on success",
"domain": "hydra:Operation",
"range": "hydra:Class",
"vs:term_status": "stable"
},
{
"@id": "hydra:StatusCodeDescription",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "Status code description",
"comment": "Additional information about a status code that might be returned.",
"vs:term_status": "stable"
},
{
"@id": "hydra:statusCode",
"@type": "rdf:Property",
"label": "status code",
"comment": "The HTTP status code",
"domain": "hydra:StatusCodeDescription",
"range": "xsd:integer",
"vs:term_status": "stable"
},
{
"@id": "hydra:title",
"@type": "rdf:Property",
"subPropertyOf": "rdfs:label",
"label": "title",
"comment": "A title, often used along with a description.",
"range": "xsd:string",
"vs:term_status": "testing"
},
{
"@id": "hydra:description",
"@type": "rdf:Property",
"subPropertyOf": "rdfs:comment",
"label": "description",
"comment": "A description.",
"range": "xsd:string",
"vs:term_status": "testing"
},
{
"@id": "hydra:Error",
"@type": "hydra:Class",
"subClassOf": "hydra:StatusCodeDescription",
"label": "Error",
"comment": "A runtime error, used to report information beyond the returned status code.",
"vs:term_status": "stable"
},
{
"@id": "hydra:Collection",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "Collection",
"comment": "A collection holding references to a number of related resources.",
"vs:term_status": "testing"
},
{
"@id": "hydra:member",
"@type": "hydra:Link",
"label": "member",
"comment": "A member of the collection",
"domain": "hydra:Collection",
"range": "hydra:Resource",
"vs:term_status": "testing"
},
{
"@id": "hydra:PagedCollection",
"@type": "hydra:Class",
"subClassOf": "hydra:Collection",
"label": "PagedCollection",
"comment": "A PagedCollection is a subclass of Collection with the only difference that its members are sorted and only a subset of all members are returned in a single PagedCollection. To get the other members, the nextPage/previousPage properties have to be used.",
"vs:term_status": "testing"
},
{
"@id": "hydra:totalItems",
"@type": "rdf:Property",
"label": "total items",
"comment": "The total number of items referenced by a collection or a set of interlinked PagedCollections.",
"domain": "hydra:Collection",
"range": "xsd:integer",
"vs:term_status": "testing"
},
{
"@id": "hydra:itemsPerPage",
"@type": "rdf:Property",
"label": "items per page",
"comment": "The maximum number of items referenced by each single PagedCollection in a set of interlinked PagedCollections.",
"domain": "hydra:PagedCollection",
"range": "xsd:integer",
"vs:term_status": "testing"
},
{
"@id": "hydra:firstPage",
"@type": "hydra:Link",
"label": "first page",
"comment": "The first page of an interlinked set of PagedCollections",
"domain": "hydra:PagedCollection",
"range": "hydra:PagedCollection",
"vs:term_status": "testing"
},
{
"@id": "hydra:lastPage",
"@type": "hydra:Link",
"label": "last page",
"comment": "The last page of an interlinked set of PagedCollections",
"domain": "hydra:PagedCollection",
"range": "hydra:PagedCollection",
"vs:term_status": "testing"
},
{
"@id": "hydra:nextPage",
"@type": "hydra:Link",
"label": "next page",
"comment": "The page following the current instance in an interlinked set of PagedCollections",
"domain": "hydra:PagedCollection",
"range": "hydra:PagedCollection",
"vs:term_status": "testing"
},
{
"@id": "hydra:previousPage",
"@type": "hydra:Link",
"label": "previous page",
"comment": "The page preceding the current instance in an interlinked set of PagedCollections",
"domain": "hydra:PagedCollection",
"range": "hydra:PagedCollection",
"vs:term_status": "testing"
},
{
"@id": "hydra:search",
"@type": "hydra:TemplatedLink",
"label": "search",
"comment": "A IRI template that can be used to query a collection",
"range": "hydra:IriTemplate",
"vs:term_status": "testing"
},
{
"@id": "hydra:freetextQuery",
"@type": "rdf:Property",
"label": "freetext query",
"comment": "A property representing a freetext query.",
"range": "xsd:string",
"vs:term_status": "testing"
},
{
"@id": "hydra:TemplatedLink",
"@type": "hydra:Class",
"subClassOf": [ "hydra:Resource", "rdf:Property" ],
"label": "Templated Link",
"comment": "A templated link.",
"vs:term_status": "testing"
},
{
"@id": "hydra:IriTemplate",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "IRI Template",
"comment": "The class of IRI templates.",
"vs:term_status": "testing"
},
{
"@id": "hydra:template",
"@type": "rdf:Property",
"label": "template",
"comment": "An IRI template as defined by RFC6570.",
"seeAlso": "http://tools.ietf.org/html/rfc6570",
"domain": "hydra:IriTemplate",
"range": "xsd:string",
"vs:term_status": "testing"
},
{
"@id": "hydra:mapping",
"@type": "rdf:Property",
"label": "mapping",
"comment": "A variable-to-property mapping of the IRI template.",
"domain": "hydra:IriTemplate",
"range": "hydra:IriTemplateMapping",
"vs:term_status": "testing"
},
{
"@id": "hydra:IriTemplateMapping",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"label": "IriTemplateMapping",
"comment": "A mapping from an IRI template variable to a property.",
"vs:term_status": "testing"
},
{
"@id": "hydra:variable",
"@type": "rdf:Property",
"label": "variable",
"comment": "An IRI template variable",
"domain": "hydra:IriTemplateMapping",
"range": "xsd:string",
"vs:term_status": "testing"
}
]
}
@prefix meme: <http://memegenerator.net/vocab/meme#> .
@prefix schema: <http://schema.org/> .
<http://memegenerator.net/instance/46341004> meme:bottomText "EVERYONE GETS AN IRI!!!!" .
<http://memegenerator.net/instance/46341004> meme:topText "You GET AN IRI, You GET AN IRI" .
<http://memegenerator.net/instance/46341004>
schema:url "http://memegenerator.net/instance/46341004" .
<http://memegenerator.net/instance/46341004>
schema:image "http://cdn.memegenerator.net/instances/46341004.jpg" .
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:meme="http://memegenerator.net/vocab/meme#"
xmlns:schema="http://schema.org/">
<rdf:Description
rdf:about="http://memegenerator.net/instance/46341004"
schema:url="http://memegenerator.net/instance/46341004"
schema:image="http://cdn.memegenerator.net/instances/46341004.jpg">
<meme:topText>You GET AN IRI, You GET AN IRI</meme:topText>
<meme:bottomText>EVERYONE GETS AN IRI!!!!</meme:bottomText>
</rdf:Description>
</rdf:RDF>
from flask import Flask, Response
import json
app = Flask(__name__)
###===================================================================
### Data access functions
###===================================================================
MEME_DB = {
"bn0x9np": {
"@id": "/meme/bn0x9np",
"@type": ["hydra:Link", "meme:MemeDetailPage"],
"name": "Its an unbearably small world",
"image": "http://i.imgur.com/ej3mFrZb.jpg",
"url": "/meme/bn0x9np",
},
"DiaODFK": {
"@id": "/meme/DiaODFK",
"@type": ["hydra:Link", "meme:MemeDetailPage"],
"name": "I shall not pass.",
"image": "http://i.imgur.com/DiaODFKb.jpg",
"url": "/meme//DiaODFK"
}
}
class DB(object):
def search(self, query):
"""
Returns a list of meme:Meme objects
"""
return [MEME_DB['bn0x9np'], MEME_DB['DiaODFK']]
def recent(self):
"""
Returns a list of recent meme:Meme objects
"""
return [MEME_DB['bn0x9np'], MEME_DB['DiaODFK']]
def meme(self, index):
return MEME_DB.get(index)
###===================================================================
### Utilities
###===================================================================
def _json_response(data):
return Response(
json.dumps(
_merge_dict(_web_page(), data)
),
content_type = "application/json",
)
def _merge_dict(base, extension):
return dict(base, **extension)
###===================================================================
### Base objects
###===================================================================
def _web_page():
return {
"@context": "/meme.jsonld",
"homepage": "/",
"searchLink": {
"@type": "IriTemplate",
"template": "/meme-search{?q}",
"mappings": [
{
"@type": "IriTemplateMapping",
"variable": "q",
"proprety": "hydra:freetextQuery",
"required": True
}
]
},
}
###===================================================================
### Resources
###===================================================================
###-------------------------------------------------------------------
### meme.jsonld resource
###-------------------------------------------------------------------
@app.route("/meme.jsonld")
def meme_jsonld():
return Response(
open("./meme.jsonld").read(),
content_type = "application/json"
)
###-------------------------------------------------------------------
### meme:SearchResultsPage
###-------------------------------------------------------------------
@app.route("/meme-search")
def meme_search():
query = ""
return _json_response(
_search_collection(query)
)
def _search_collection(query):
"""
Returns a meme:SearchResultPage
"""
return {
"@type": "meme:SearchResultPage",
"member": _search_member(query)
}
def _search_member(query):
"""
Returns a list of meme:Meme objects
"""
# TODO: do the full text search
return DB().search(query)
###-------------------------------------------------------------------
### Meme Detail Page
###-------------------------------------------------------------------
@app.route("/meme/<index>")
def meme(index):
# TODO: do lookup
return _json_response(_meme_resource(index))
def _meme_resource(index):
"""
Returns a meme:MemeDetailPage
"""
meme = DB().meme(index)
if meme is not None:
return meme
###-------------------------------------------------------------------
### meme:IndexPage
###-------------------------------------------------------------------
@app.route("/")
def index():
return _json_response(_index_resource())
def _index_resource():
"""
Returns a meme:IndexPage
"""
return {
"@type": "meme:IndexPage",
"recent": _recent_collection(),
}
def _recent_collection():
return {
"@type": "hydra:RecentMemeCollection",
"member": DB().recent()
}
if __name__ == '__main__':
app.run(debug=True)
;;; n3-mode.el --- mode for Notation 3
;; Copyright (c) 2003-2007 Hugo Haas <hugo@larve.net>
;; re-worked and re-published by kurtjx (c) 2010 <kurtjx@gmail.com>
;; For documentation on Notation 3, see:
;; http://www.w3.org/DesignIssues/Notation3.html
;;; Comentary:
;; Goals:
;; - sytax highlighting
;; - completion
;; - indentation
;; What it does now:
;; - Syntax highlighting
;; - comment/uncomment block with M-;
;;; Code:
;; the command to comment/uncomment text
(defun n3-comment-dwim (arg)
"Comment or uncomment current line or region in a smart way.
For detail, see `comment-dwim'."
(interactive "*P")
(require 'newcomment)
(let ((deactivate-mark nil) (comment-start "#") (comment-end ""))
(comment-dwim arg)))
(setq n3-highlights
'(("\\(@prefix\\)\\>" 1 font-lock-keyword-face t)
("\\(a\\)\\>" 1 font-lock-keyword-face t)
("\\(\\S-*?:\\)" 1 font-lock-type-face t)
(":\\(.+?\\)[ ;.]" 1 font-lock-constant-face t)
("\\(<.*?>\\)" 1 font-lock-function-name-face t)
("\\(\\\".*?\\\"\\)" 1 font-lock-string-face t)
; Bug: some trailing characters are highlighted; restricting comments regexp
; ("\\(#.*\\)" 1 font-lock-comment-face t)
("^\\s-*\\(#.*\\)" 1 font-lock-comment-face t)
)
)
;;(define-generic-mode 'n3-mode
(define-derived-mode n3-mode fundamental-mode
;; setup tab key not working :/
;;(setq c-basic-offset 4)
;; syntax highlighting
(setq font-lock-defaults '(n3-highlights))
;; modify the keymap M-; comments/uncomments region
(define-key n3-mode-map [remap comment-dwim] 'n3-comment-dwim)
;; comments: “# ...”
(modify-syntax-entry ?# "< b" n3-mode-syntax-table)
(modify-syntax-entry ?\n "> b" n3-mode-syntax-table)
;; description
"Mode for Notation 3 documents."
)
SPARQLWrapper==1.5.2
html5lib==0.95
isodate==0.5.0
microdata==0.4.1
pyparsing==2.0.1
rdflib==4.1.0
-e git+https://github.com/RDFLib/rdflib-jsonld.git@e5c4b5f6f4de1e79c93503c0b28d87934a674da1#egg=rdflib_jsonld-master
-e git+https://github.com/edsu/rdflib-microdata.git@2b2eb632a3407bf889d03e1c3dde8657d56c5c6e#egg=rdflib_microdata-master
requests==2.2.1
six==1.5.2
wsgiref==0.1.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment