Hey,

I'm toying with the RDF output, to see how it can be improved. One thing 
I want to do early is to add the possibility to specify the RDF names 
for properties ad types. I've added a @URI annotation for this purposes 
and here's an example:
@URI( "http://purl.org/dc/dcmitype/PhysicalObject";)
interface TestEntity
     extends EntityComposite
{
     @URI( DcRdf.DC+"title")
     @NotEmpty Property<String> name();

     Association<TestEntity> association();

     ManyAssociation<TestEntity> manyAssoc();

     @URI("http://www.w3.org/2001/vcard-rdf/3.0#GROUP";)
     ListAssociation<TestEntity> listAssoc();
}
---
This sets the type to a known RDF-type, the "name" property becomes a 
Dublin Core Title, and the listAssoc() is a vCard GROUP.

The resulting RDF (from EntitySerializer) becomes:
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
        xmlns:dc="http://purl.org/dc/elements/1.1/";
        xmlns:ns1="http://www.w3.org/2001/vcard-rdf/3.0#";
        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";>
<PhysicalObject xmlns="http://purl.org/dc/dcmitype/"; 
rdf:about="urn:qi4j:entity:org.qi4j.library.rdf.entity.TestEntity/test2">
        <dc:title>Niclas</dc:title>
        <identity 
xmlns="urn:qi4j:entity:org.qi4j.entity.Identity:">test2</identity>
        <association 
xmlns="urn:qi4j:entity:org.qi4j.library.rdf.entity.TestEntity:" 
rdf:resource="urn:qi4j:entity:org.qi4j.library.rdf.entity.TestEntity/test1"/>
        <manyAssoc 
xmlns="urn:qi4j:entity:org.qi4j.library.rdf.entity.TestEntity:">
                <rdf:Bag>
                        <rdf:li 
rdf:resource="urn:qi4j:entity:org.qi4j.library.rdf.entity.TestEntity/test1"/>
                </rdf:Bag>
        </manyAssoc>
        <ns1:GROUP>
                <rdf:Seq>
                        <rdf:li 
rdf:resource="urn:qi4j:entity:org.qi4j.library.rdf.entity.TestEntity/test1"/>
                        <rdf:li 
rdf:resource="urn:qi4j:entity:org.qi4j.library.rdf.entity.TestEntity/test1"/>
                        <rdf:li 
rdf:resource="urn:qi4j:entity:org.qi4j.library.rdf.entity.TestEntity/test1"/>
                </rdf:Seq>
        </ns1:GROUP>
</PhysicalObject>
</rdf:RDF>
---

which is quite nice :-) This will make it easier for non-Java clients to 
consume the RDF, and also helps versioning (as you can specify exact 
schema versions using this approach).

What do you think? Any comments on how to improve, or any dangers with it?

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to