Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

N3 notation to RDF/XML

Tags:

rdf

rdfs

n3

I have to sample N3 and I need to convert it to the corresponds RDF/XML format please , any help ?

 crop:AttributeValue a rdfs:Class . 
 crop:SomeValue a rdfs:Class; rdfs:subClassOf crops:AttributeValue .

 crop:SomeValue/7 a crops:SomeValue .

 crop:SomeValue a rdf:Property ; rdfs:range crops:SomeValue .
like image 505
M.M Avatar asked Jul 07 '11 14:07

M.M


1 Answers

You need to specifiy a bit more info, e.g. like this

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

crop:AttributeValue a rdfs:Class . crop:SomeValue a rdfs:Class; rdfs:subClassOf crops:AttributeValue .

<http://example.org/foo#SomeValue/7> a crops:SomeValue .

crop:SomeValue a rdf:Property ; rdfs:range crops:SomeValue .

Replace the namespaces for crop and crops with the correct ones.

This would be the following in RDF/XML

<?xml version="1.0"?>
<rdf:RDF xmlns:rdfs="http://www.w3.org/TR/rdf-schema/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:crops="http://example.org/foo#">
    <rdfs:Class rdf:about="http://example.org/foo#SomeValue">
        <rdfs:subClassOf>
            <rdfs:Class rdf:about="http://example.org/foo#AttributeValue" />
        </rdfs:subClassOf>
        <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
        <rdfs:range rdf:resource="http://example.org/foo#SomeValue" />
    </rdfs:Class>
    <crops:SomeValue rdf:about="http://example.org/foo#SomeValue/7" />
</rdf:RDF>

Here is an online tool for the conversion : http://www.rdfabout.com/demo/validator/

like image 178
Timo Westkämper Avatar answered Sep 23 '22 16:09

Timo Westkämper