Vocabularies/PTO

From GoodRelations Wiki
Jump to: navigation, search

The Product Types Ontology Extension for GoodRelations

GoodRelations Domain Extension
Name The Product Types Ontology (PTO)
Description This extension module for GoodRelations allows using any Wikipedia URI for defining the types of product or services for schema.org and GoodRelations markup.
Status mature
Level advanced
Tags goodrelations, wikipedia, dbpedia, specificity, product types
URL http://www.productontology.org
Namespace http://www.productontology.org/id/
Prefix pto:

Overview

www.productontology.org allows using any Wikipedia URI for defining the types of product or services for schema.org and GoodRelations markup.

It basically provides product class definitions for each lemma ("word") defined in the English Wikipedia.

See

for more details

Resources

  • Ontology Specification: The ontology is highly modularized, i.e., you can retrieve the definitions for each class individually.

Example: Laser_printer

Quickstart

We sell a hammer for for $ 19.99

<!DOCTYPE html>
<html version="HTML+RDFa 1.1" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>An offer to sell a / some Hammer</title>
</head>
<body>
<div xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     xmlns:foaf="http://xmlns.com/foaf/0.1/"
     xmlns:gr="http://purl.org/goodrelations/v1#"
     xmlns:pto="http://www.productontology.org/id/"
     xmlns:foo="http://example.com/"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#">

<!-- The agent (person or company) who is offering it -->
   <div about="#ACMECorp" typeof="gr:BusinessEntity">
      <div property="gr:legalName">ACME Corp</div>
      <div rel="gr:offers">
<!-- The offer to sell it -->	
         <div about="#offer" typeof="gr:Offering">
            <div rel="gr:hasBusinessFunction" resource="http://purl.org/goodrelations/v1#Sell"></div>
            <div rel="gr:includes">
<!-- The object -->	
               <div about="#myObject" typeof="http://www.productontology.org/id/Hammer">
                  <div rel="rdf:type" resource="http://purl.org/goodrelations/v1#SomeItems"></div>
                  <div property="gr:description" xml:lang="en">... a longer description ...</div>
                  <div property="gr:name" xml:lang="en">.. a short name for the object ...</div>
               </div>
            </div>
            <div rel="foaf:page" resource="http://URI_of_the_page_containing_the_offer"></div>
            <div rel="gr:hasPriceSpecification">
               <div typeof="gr:UnitPriceSpecification">
                  <div property="gr:hasCurrency" content="USD" datatype="xsd:string">$ </div>
                  <div property="gr:hasCurrencyValue" datatype="xsd:float">19.99</div>
                  <div property="gr:validThrough" content="2011-12-24T00:00:00+01:00" 
					   datatype="xsd:dateTime"></div>
               </div>
            </div>
            <div property="gr:validFrom" content="2011-01-24T00:00:00+01:00"
                 datatype="xsd:dateTime"></div>
            <div property="gr:validThrough" content="2011-12-24T00:00:00+01:00"
                 datatype="xsd:dateTime"></div>
         </div>
      </div>
   </div>
</div>
</body>
</html>

Examples

Scenario: We sell a hammer for for $ 19.99

Turtle Syntax

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix pto: <http://www.productontology.org/id/> .
@prefix gr: <http://purl.org/goodrelations/v1#> .
@prefix foo: <http://example.com/> .

# The object
foo:myObject a <http://www.productontology.org/id/Hammer> ;
	a gr:SomeItems ;
	gr:name "... a short name for the object ..."@en ;
	gr:description "... a longer description ..."@en .

# The agent (person or company) who is offering it
foo:ACMECorp a gr:BusinessEntity ;
	gr:legalName "ACME Corp" ;
	gr:offers foo:Offer .

# The offer to sell it
foo:Offer a gr:Offering ;
	gr:includes foo:myObject;
	foaf:page <http://URI_of_the_page_containing_the_offer.com>;
	gr:hasBusinessFunction gr:Sell ;
	gr:validFrom "2011-01-24T00:00:00+01:00"^^xsd:dateTime ;
	gr:validThrough "2011-12-24T00:00:00+01:00"^^xsd:dateTime ;
	gr:hasPriceSpecification
         [ a gr:UnitPriceSpecification ;
           gr:hasCurrency "USD"^^xsd:string ;
           gr:hasCurrencyValue "19.99"^^xsd:float ;
           gr:validThrough "2011-12-24T00:00:00+01:00"^^xsd:dateTime ] .

Microdata Syntax / Combination with schema.org

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>An offer to sell a / some Hammer</title>
</head>
<body>
<div itemscope itemtype="http://schema.org/Product" itemid="#product">
    <link itemprop="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
      href="http://www.productontology.org/id/Hammer" />
    <span itemprop="name">.. a short name for the object ...</span>
    Product description:
    <span itemprop="description">... a longer description ...</span>
    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer" itemid="#offer">
        <span itemprop="price">$19.99</span>
        <a itemprop="availability" href="http://schema.org/InStock"></a>In stock
    </div>
</div>
</body>
</html>

RDF/XML

<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns:gr="http://purl.org/goodrelations/v1#"
  xmlns:pto="http://www.productontology.org/id/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
  xmlns:foo="http://example.com/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<!-- The object -->
  <rdf:Description rdf:about="http://example.com/myObject">
    <rdf:type rdf:resource="http://www.productontology.org/id/Hammer"/>
    <rdf:type rdf:resource="http://purl.org/goodrelations/v1#SomeItems"/>
    <gr:name xml:lang="en">... a short name for the object ...</gr:name>
    <gr:description xml:lang="en">... a longer description ...</gr:description>
  </rdf:Description>
<!-- The agent (person or company) who is offering it -->
  <gr:BusinessEntity rdf:about="http://example.com/ACMECorp">
    <gr:legalName>ACME Corp</gr:legalName>
    <gr:offers rdf:resource="http://example.com/Offer" />
  </gr:BusinessEntity>
<!-- The offer to sell it -->
  <gr:Offering rdf:about="http://example.com/Offer">
    <gr:includes rdf:resource="http://example.com/myObject" />
    <foaf:page rdf:resource="http://URI_of_the_page_containing_the_offer"/>
    <gr:hasBusinessFunction rdf:resource="http://purl.org/goodrelations/v1#Sell"/>
    <gr:validFrom rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">
      2011-01-24T00:00:00+01:00</gr:validFrom>
    <gr:validThrough rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">
      2011-12-24T00:00:00+01:00</gr:validThrough>
    <gr:hasPriceSpecification>
      <gr:UnitPriceSpecification>
        <gr:hasCurrency
          rdf:datatype="http://www.w3.org/2001/XMLSchema#string">USD</gr:hasCurrency>
        <gr:hasCurrencyValue
          rdf:datatype="http://www.w3.org/2001/XMLSchema#float">19.99</gr:hasCurrencyValue>
        <gr:validThrough rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">
          2011-12-24T00:00:00+01:00</gr:validThrough>
      </gr:UnitPriceSpecification>
    </gr:hasPriceSpecification>
  </gr:Offering>
</rdf:RDF>

SPARQL Queries

prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix pto: <http://www.productontology.org/id/>
prefix gr: <http://purl.org/goodrelations/v1#>
prefix foo: <http://example.com/>

# Find the cheapest offer for a Hammer

SELECT * WHERE{
?company gr:offers ?offer .
?offer a gr:Offering .
?offer gr:hasBusinessFunction gr:Sell .
OPTIONAL {?offer rdfs:label ?label } .
OPTIONAL {?offer gr:name ?label } .
OPTIONAL {?offer rdfs:comment ?label } .
OPTIONAL {?offer gr:description ?label } .
?offer gr:hasPriceSpecification ?p .
?p a gr:UnitPriceSpecification .
?p gr:hasCurrency ?currency .
?p gr:hasCurrencyValue ?price .
?offer gr:includes ?product .
?product a <http://www.productontology.org/id/Hammer> .
}
ORDER BY (?price)
LIMIT 10

Extending the Facebook Open Graph Protocol (OGP)

You can also use the class definitions from www.productontology.org for better describing the type of your page or product for the Facebook Open Graph Protocol. Simply define the namespace prefix pto: in the <html> element of your page

<html version="HTML+RDFa 1.1"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:pto="http://www.productontology.org/id/"
	>

and use the compact URI (CURIE), e.g.

pto:Hammer

in combination with og:type as follows:

	<meta property="og:type" content="pto:Hammer"/>

Here is a complete example:

<!DOCTYPE html>
<html version="HTML+RDFa 1.1" xmlns="http://www.w3.org/1999/xhtml" lang="en"
	xmlns:og="http://ogp.me/ns#"
    xmlns:fb="http://www.facebook.com/2008/fbml"
	xmlns:pto="http://www.productontology.org/id/">
<head>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
    <title>Example for Facebook Opengraph Protocol on a page describing a(n)/some Hammer</title>
	<meta property="og:title" content="Example for Facebook Opengraph Protocol on a page 
describing a hammer"/>
  	<meta property="og:type" content="pto:Hammer"/> <!-- this is the important line -->
  	<meta property="og:url"content="http://www.uri_for_the_item.com"/>
  	<meta property="og:image" content="http://www.uri_of_product_image.com/image.png"/>
  	<meta property="og:site_name" content="Name of Site"/>
  	<meta property="fb:admins" content="USER_ID"/>
  	<meta property="og:description" content="long text describing the product"/>
</head>
<body>
<!-- Human-readable page content -->
Example for combining the Facebook Opengraph Protocol with
http://www.productontology.org for more specific ogp:type statements.
<!-- GoodRelations markup to be added here -->
</body>
</html>