W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > November 2011

Re: rdf:type

From: Paul Rogers <PaulRogers@smarttech.com>
Date: Wed, 23 Nov 2011 11:11:27 -0700
To: Gregg Kellogg <gregg@kellogg-assoc.com>
CC: "public-rdf-ruby@w3.org" <public-rdf-ruby@w3.org>
Message-ID: <CAF284CA.6D2%PaulRogers@smarttech.com>
Thanks Gregg,

I like the use of Turtle, and am trying that now, however I think my question was badly worded.

What Im trying to do is crete that xml using the ruby libs.

Ive been doing this:



graph = RDF::Graph.new


s1 = RDF::URI.new("http://server/path/resources/temppersonresource")

p1 = RDF::URI.new("http://www.w3.org/2001/vcard-rdf/3.0#Given")

o1 = "Paul"   # given name


statement = RDF::Statement.new(s1, p1, 01)    # this gave an rdf literal

graph << statement



But I cant figure out how to get the rdf:type entry.


Im looking into the ruby-turtle things now.


Paul





From: Gregg Kellogg <gregg@kellogg-assoc.com<mailto:gregg@kellogg-assoc.com>>
Date: Wed, 23 Nov 2011 08:39:24 -0700
To: Paul Rogers <PaulRogers@smarttech.com<mailto:PaulRogers@smarttech.com>>
Cc: "public-rdf-ruby@w3.org<mailto:public-rdf-ruby@w3.org>" <public-rdf-ruby@w3.org<mailto:public-rdf-ruby@w3.org>>
Subject: Re: rdf:type

Paul, I usually author in Turtle and then distill to other formats to do this kind of stuff. The form your looking for for your example is the following:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:foo="http://example.org/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xml:base="">
  <rdf:Description rdf:about="http://server/path/temppersonresource">
    <rdf:type rdf:resource="http://server/path/Person"/>
    <foo:country-name>US</foo:country-name>
  </rdf:Description>
</rdf:RDF>

Much easier to write as Turtle:

@prefix foo: <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://server/path/temppersonresource> a <http://server/path/Person>;
   foo:country-name "US" .

You can use my online service to validate and transform between representations. It's at http://rdf.greggkellogg.net/distiller.

Gregg Kellogg

Sent from my iPad

On Nov 23, 2011, at 1:14 AM, "Paul Rogers" <PaulRogers@smarttech.com<mailto:PaulRogers@smarttech.com>> wrote:

Hello, Im a complete beginner with rdf.

Im using the ruby rdf xml libraries ( rdf/rdfxml)

How would I create a <rdf:type rdf:resource="http://server/path/Person"/>
Entry as a child of rdf:description ?

Ie like this sample


<rdf:Description rdf:about="http://server/path/temppersonresource">

       <j.3:country-name>US</j.3:country-name>

      <rdf:type rdf:resource="http://server/path/Person"/>

    </rdf:Description>


I have created the rdf:description ok, as well as various statements, but am stumped on the type.


Hope that is enough of an explanation.


Thanks


Paul
Received on Wednesday, 23 November 2011 18:12:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 23 November 2011 18:12:10 GMT