W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > May 2012

building of an RDF/SKOS graph

From: Antoine Logean <antoine.logean@opendata.ch>
Date: Fri, 18 May 2012 09:40:14 +0200
Message-ID: <CA+WeWwz5YWO1g6b5ibizBWHZ7tjMvi7Yh=Z5mKS+OEAmV3sGeg@mail.gmail.com>
To: public-rdf-ruby@w3.org
Hi,

I would like to build a RDF/SKOS graph.

I started like this:

*require 'rubygems'
require 'rdf'
require 'rdf/turtle'
require 'uuid'

include RDF

RDF::Turtle::Writer.open("my_skos_model.ttl") do |writer|
  writer << RDF::Graph.new do |graph|

    bnode     = RDF::Node.new # a blank node

    predicate_1 = RDF::type
    object_1    = RDF::SKOS.Concept


    predicate_2 = RDF::SKOS.prefLabel
    object_2    = RDF::Literal.new("some_label", :language => :en)

    graph << RDF::Statement.new(bnode, predicate_1, object_1)
    graph << RDF::Statement.new(bnode, predicate_2, object_2)

  end
end*

This give me as output :


 [ a <http://www.w3.org/2004/02/skos/core#Concept>;
    <http://www.w3.org/2004/02/skos/core#prefLabel> "some_label"@en] .

but I would like to have something like this:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix skos: <http://www.w3.org/2004/02/skos/core#>.
@prefix dct: <http://purl.org/dc/terms/>.
@prefix : <http://mydomain/>.

:_00000001 a skos:Concept;
           skos:prefLabel "some_label"@en.

How can I have in the output
- the list of shema ?
- the bnode

Thanks in advance for your help

Antoine
Received on Saturday, 19 May 2012 05:34:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 19 May 2012 05:34:51 GMT