Srecko
Srecko

Reputation: 199

Jena, RDF, Data Cube vocabulary

I know I'm doing something wrong, but I don't know what... I'm trying to generate RDF file using Data Cube vocabulary.

The thing is, that output should look like this:

<qb:DataSet rdf:about="about...">
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">label.</rdfs:label>
<dcterms:subject rdf:resource="http://purl.org/linked-data/sdmx/2009/subject#2.2"/>

...

but, all I get is:

<qb:DataSet rdf:about="about...">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">.</rdfs:label>
    <dcterms:subject>
         <rdf:Thing rdf:about="http://purl.org/linked-data/sdmx/2009/subject#2.2"/>
    </dcterms:subject>

I could provide code sample, but this could be enough... The problem shouldn't be that hard. I need Resource with another Resource...

Best, Srecko

Upvotes: 0

Views: 523

Answers (1)

Ian Dickinson
Ian Dickinson

Reputation: 13305

The two forms of your RDF are basically equivalent. The second form contains some addition information, namely the extra triple:

<http://purl.org/linked-data/sdmx/2009/subject#2.2> rdf:type rdf:Thing .

That won't hurt, although Thing is not a standard term in the RDF namespace - you possibly meant owl:Thing. The general rule of thumb with RDF is to not worry about the exact syntactic form of the output, since a given RDF model may have many different serialisations that all parse to exactly the same set of triples, and hence have the same meaning semantically. This is especially true of the XML serialization. Unless you do need XML for some reason (e.g. processing with another part of your toolchain), I'd suggest using the Turtle output serialisation. It's much more compact and human-readable.

If you want more specific advice about the model you're generating, it would help if you posted the code.

By the way, if you do need XML so that you can process it with other XML tools, you'll probably want to generate the output yourself rather than rely on Model.write(). This is because a small change in the content of the model can cause a non-trivial change in the XML generated by write. This can make writing XSLT stylesheets and the like a major pain. Better to generate your own serialization, because then you have more control over the output using your knowledge of your particular domain model.

Upvotes: 5

Related Questions