W3C home > Mailing lists > Public > semantic-web@w3.org > December 2012

Re: RDFa Lite API (JavaScript)

From: Karl Dubost <karld@opera.com>
Date: Mon, 10 Dec 2012 16:49:41 +0900
Message-Id: <4CBC6947-7FAD-47DC-AD1F-96C22AD16A6A@opera.com>
Cc: "semantic-web@w3.org Web" <semantic-web@w3.org>
To: Paul Groth <pgroth@gmail.com>
Let's take this markup which describes

    Two places 
    with the name "Tsujido" and "Meguro
    and their associated longitude and latitude.


    <ul vocab="http://schema.org/">
        <li typeof="Place">
            <span property="name">Tsujido</span>
            <div property="geo"
                 typeof="GeoCoordinates">
                 <meta property="latitude" content="35.336833"/>
                 <meta property="longitude" content="139.447083"/>
                 </div>
            </li>
        <li typeof="Place">
            <span property="name">Meguro</span>
            <div property="geo"
                 typeof="GeoCoordinates">
                 <meta property="latitude" content="35.633983"/>
                 <meta property="longitude" content="139.71600"/>
                 </div>
            </li>
    </ul>


I would love to be able to do something such as 

    "for each place return the longitude"


    var places = document.getItems('http://schema.org/Place');
    for (var i = places.length - 1; i >= 0; i--) {
       longitude = places[i].properties['longitude']
       console.log(longitude);
    };

And then in the console:

    139.71600
    139.447083


-- 
Karl Dubost - http://dev.opera.com/
Developer Relations, Opera Software
Received on Monday, 10 December 2012 08:00:57 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 08:45:31 UTC