0

I want to create an RDFS ontology describing some specific classes and properties. Then I want to add RDFa into HTML with the vocabulary I defined in RDFS. I know that we need to provide a URL to the vocabulary in RDFa, but I am not sure where to put my RDFS file in the web app or how to deploy the RDFS file.

When I add RDFa with schema.org, the HTML is like:

  <div vocab="http://schema.org/" typeof="Person">
  <span property="name">Jane Doe</span>
  <img src="janedoe.jpg" property="image" alt="Photo of Jane Joe"/>
  <span property="jobTitle">Professor</span>
  <div property="address"  typeof="PostalAddress">
    <span property="streetAddress">
      20341 Whitworth Institute
      405 N. Whitworth
    </span>
    <span property="addressLocality">Seattle</span>,
    <span property="addressRegion">WA</span>
    <span property="postalCode">98052</span>
  </div>
  <span property="telephone">(425) 123-4567</span>
  <a href="mailto:jane-doe@xyz.edu" property="email">
    jane-doe@xyz.edu</a>
  Jane's home page:
  <a href="http://www.janedoe.com" property="url">janedoe.com</a>
  Graduate students:
  <a href="http://www.xyz.edu/students/alicejones.html" property="colleague">
    Alice Jones</a>
  <a href="http://www.xyz.edu/students/bobsmith.html" property="colleague">
    Bob Smith</a>
</div>

In the beginning of the HTML

<div vocab="http://schema.org/" typeof="Person">

it states using the vocabulary Schema.org.

I want to ask how to use own RDFS. Also, how can I validate the RDFa is properly linked to my RDFS and written correctly

Echan
  • 1,395
  • 14
  • 15

1 Answers1

3

There are two common ways how to host a vocabulary/ontology:

  • hash namespace (e.g., http://example.com/vocabulary#Person)
  • slash namespace (e.g., http://example.com/vocabulary/Person)

The W3C Working Group Note Best Practice Recipes for Publishing RDF Vocabularies contains some recipes, which illustrate example configurations.

Let’s assume that you go with a hash namespace, so that the complete vocabulary is contained in http://example.com/my-voc, and a class like "Person" would have the URI http://example.com/my-voc#Person.

Now you want to use classes/properties from your vocabulary in your RDFa. So let’s add a prefix for each vocabulary you want to use (you could also keep using vocab for a "default", prefix-less vocabulary, if you want to):

<div prefix="schema: http://schema.org/ foo: http://example.com/my-voc#">
</div>

You can now use schema:Person for Schema.org’s Person class, and foo:Person for the Person class from your own vocabulary.

unor
  • 92,415
  • 26
  • 211
  • 360
  • Thank you very much. But I am very confused that how to validate RDFa when using own RDFS? – Echan May 26 '15 at 09:55
  • @YichenHE: How do you validate your RDFa? It should make no difference which vocabulary you are using. – unor May 26 '15 at 12:47