rdf formats for linked data by mabi harandi. rdf is not a format, it is a model for data so: it will...

34
RDF formats for Linked Data by Mabi Harandi

Upload: nancy-squier

Post on 16-Dec-2015

218 views

Category:

Documents


2 download

TRANSCRIPT

RDF formats for Linked Data

by Mabi Harandi

RDF is not a format, it is a model for data So:

• It will provide supports for different formats like :Turtle —A simple, human-readable format RDF/XML —The original RDF format in XML RDFa —RDF embedded in HTML attributes JSON-LD —A newer format aimed at web

developers

Why different formats?

And what is the point of these different formats?

Turtle —human-readable RDF

it simply consists of subject, predicate, object followed by terminator.

Some points of Turtle

• To use any URI(Uniform Resource Identifier) it should be declared at first.

• If they are only different in objects, then different objects could be separated by commas.

• If they have the common subject it is possible not to repeat the same subject instead separate different predicate and object by semicolon.

• Blank nodes:– Sometimes we know that something exists but we

don’t know exactly its identity.• How to represent them

_: these identifier will be thrown away while parsing is done and replaced with local blank identifier.

If there are more than blank node then: All the triples that has unknown subject will be in the

brackets [rdf : type bio : woman; bio : livedIn geo : England ]

• To abbreviate the URI, @base could be used. • It defines the base URI and all relative URI will

append to that.– As an example if @prefix ex: <http://example.com/> . is replaced

with a base URI @base <http://example.com/> .Then it is possible to use relative URIs to replace any

references to the ex: vocabulary. ex:Zoo would change to the relative URI <Zoo>. Rdf:type could be replaced with a

RDF/XML—RDF for enterprises

• It was an original serialization format for RDF • Due to some complexities of its formatting

and its standardization prior to XML, it’s not used as much as before.

• Lots of enterprise users because of XML infrastructure are using this format.

How does the format look like?

• It seems it is series of triples that are connected head to tail.

• Subject followed by a predicate followed by an object URI or object literal

• This pattern could repeat each time , an object becomes a subject.

QNames

• They are prefixed URI which is defined as XML namespaces in the opening XML tag

• The same purpose like prefix naming schema in Turtle: to make shorter URI for reading

• restriction: a part after the colon should be a valid XML element name.

• It also has a definition of a base URI to make abbreviation.

• By using the xml:base directive in the rdf:RDF tag, near the namespace declarations.

• So it replaces the ex: namespace declaration

(xmlns:ex="http://example.com/") with a base declaration

(xml:base="http://example.com").

RDFa—RDF in HTML

Isn’t it needed to have unstructured data as the structured one ?

• Data like telephone numbers, people’ names and product descriptions are unstructured but we would like them in structured format so RDFa is helping us to do that by having RDF in HTML Attributes

How is it done?

• A HTML page’s DOCTYPE is modified so RDFa parsers can quickly determine that the page is worth parsing

• HTML attributes are used to provide just enough information to create RDF triples when the page is parsed.

How is it working?• A web browser that doesn’t know what RDFa is will

simply ignore any HTML attributes it doesn’t understand • A RDFa-aware system would display exactly the same text

but also provide the RDF triple dbpedia:Bonobo rdf:type dbpedia-owl:Mammal.

• The resource attribute provides the subject• the special typeof attribute provides the rdf:type

predicate

How does it make shorter URIs?

• It is known as CURIEs: Compact URI Expressions• They are technically an extension to

RDF/XML’s Qnames– because they allow the part after the colon to

have values that aren’t valid XML element names.• CURIEs are a superset of QNames.

Examples of RDFa

• After searching for a movie then– links to reviews are present in the results

• After searching for a product– Its price is listed

JSON-LD—RDF for JavaScript Developers

• JSON (JavaScript Object Notation) for Linking Data :– an RDF serialization format in JSON• every major programming language has multiple

libraries that can parse JSON

• RDF triples in the @graph object• @id identifies RDF subjects• @type identifies the special rdf:type predicate– Other predicates are simply named as a string in

quotes• RDF objects are JSON objects – URI– a literal denoted by @value– data type or language information.

• Curly braces ({ and }) surround objects• Square brackets ([ and ]) denote arrays

Issues related to web servers and published Linked Data

• Some web browsers or other types of clients need additional support to properly display Linked Data content

• This is accomplished using the HTTP Content-Type header.

• The Content-Type header for Linked Data varies with the specific format used : text/turtle, rdf+xml

There is a point for content type of HTTP

• They are know as MIME types : Multipurpose Internet Mail Extensions

• encode multimedia email attachments as plain text during email transmission

File types and web servers

configure Apache # Directives to ensure RDF files are served as the appropriate Content-Type

AddType text/turtle .ttl AddType application/rdf+xml .rdf AddType application/ld+json .jsonld AddType application/N-Triples .nt

• The directives may be added to your Apache instance’s httpd.conf file, vhost (virtual host) configuration files, or .htaccess files.

When you have limited control over Apache

• if you can’t configure Apache directly?– .htaccess file– Cpanel

• mod_asis– Apache handlers installed by default and is used to

send a file as is

Summary

• Resource Description Framework (RDF)• RDF and Linked Data• how to find and use RDF vocabularies• Four RDF serialization formats:– Turtle – RDF/XML– RDFa – JSON-LD