rdfrdfsn3

N3 notation to RDF/XML


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 .

Solution

  • 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/