Search code examples
javascriptrdfa

Creating an rdfa in Javascript


I am getting data from dbpedia and need to create an rdfa to link back to the original sources. I really dont understand how to do this. I need to show the subject, relationships etc. Could someone give me a clear example?

http://dbpedia.org/page/Tiger

<div vocab="http://schema.org/" prefix=" dbr: http://dbpedia.org/resource/ dbo: http://dbpedia.org/ontology/" typeof="animal">

<span property="name"> Tiger </span>
<img property="dbr:image" src="cat_image_url" />
<span property="dbr:class" rel="dbr:class> Mammal </div> ?? or dbo?
<span property="dbr:age"> 24 </span>

Solution

  • You could do this:

    <link rel="dc:subject schema:about ore:isDescribedBy" about="[dbr:Tiger]" title="Tiger" href="http://dbpedia.org/page/Tiger" datatype="xsd:string" content="Tiger">
    

    and/or this:

    <dd><span about="schema:TechArticle" typeof="schema:discussionUrl dc:URI" property="foaf:primaryTopic" rel="cheminf:CHEMINF_000410" resource="http://dbpedia.org/page/Tiger"><span property="skos:prefLabel"><a href="https://en.wikipedia.org/wiki/Tiger" title="Tiger">Tiger</a>&nbsp;<img class="" alt="Exit disclaimer" src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/54/Tigress_at_Jim_Corbett_National_Park.jpg/330px-Tigress_at_Jim_Corbett_National_Park.jpg" /></span></span></dd>
    

    In <head> you would initalize vocabularies uses in <head> and <body> like this:

    <html
     prefix="
     this: http://example.com/public/organizations/ONTO/#
     bibo: http://purl.org/ontology/bibo/
     dbr: http://dbpedia.org/resources/
     dc: http://purl.org/dc/terms/
     foaf: http://xmlns.com/foaf/0.1/
     lcsh: http://id.loc.gov/authorities/subjects/
     og: http://ogp.me/ns#
     ore: http://www.openarchives.org/ore/terms/
     schema: http://schema.org/
    "
     lang="en"
     xml:lang="en"
    >
    

    and for vocabularies only used in <body> you would initialize like this:

    <body
     prefix="
     cc: http://creativecommons.org/ns#
     cheminf: http://semantiscience.org/resource/
     usgov: http://www.oegov.us/democracy/us/core/owl/usgov#
    "
     about="this:_term"
     typeof="cc:Work bibo:Document ore:Aggregation schema:TechArticle"
    >
    

    For _term you would select your own term to identify what part of about="this: you are presenting.