W3C home > Mailing lists > Public > www-archive@w3.org > April 2003

Re: [jena-dev] Model output language?

From: Dan Brickley <danbri@w3.org>
Date: Wed, 9 Apr 2003 07:07:18 -0400
To: www-archive@w3.org
Message-ID: <20030409110718.GA21961@tux.w3.org>
for ref re mozilla

attached mail follows:


Hi,

I met the same problem with jena 1.6.1. Unfortunatelly, Mozilla is 
really sensible to the way you serialize your RDF even if it's well 
serialized.

The only way I found to XUL/RDF encode from jena 1.6.1 is to use 
"RDF/XML-ABBREV" option and build myself the Seq !!

I posted in this NG a sample a few weeks ago with jena 1.6.1 
RDFDatasource generation ans XUL-tree building via this data source.
We use Jena 1.6.1 and Mozilla intensively.

Below is this sample, hope this helps !!

Regards,

Olivier Mo´ses

JAVA CODE :
-------------------------------------------
import java.io.FileWriter;
import java.io.IOException;

import com.hp.hpl.mesa.rdf.jena.common.PropertyImpl;
import com.hp.hpl.mesa.rdf.jena.mem.ModelMem;
import com.hp.hpl.mesa.rdf.jena.model.Property;
import com.hp.hpl.mesa.rdf.jena.model.RDFException;
import com.hp.hpl.mesa.rdf.jena.model.Resource;
import com.hp.hpl.mesa.rdf.jena.model.Seq;
import com.hp.hpl.mesa.rdf.jena.vocabulary.DC;


public class mozTest {

public static void main(String[] args) {
ModelMem model = new ModelMem();

try {
try {
Property containerProp = new
PropertyImpl("urn:this.is.a.test/", "items");
Resource res = model.createResource("urn:root");

Seq seq = model.createSeq();

res.addProperty(containerProp , seq);
for (int i=0;i < 3; i++) {
res = model.createResource("urn:item" + i);
res.addProperty(DC.title, "this is item #" + i);
seq.add(res);
}
seq = model.createSeq();
for (int i=0;i < 3; i++) {
res = model.createResource("urn:subitem" + i);
res.addProperty(DC.title, "this is subitem #" + i);
seq.add(res);
}

model.getResource("urn:item1").addProperty(containerProp
, seq);
model.write(new FileWriter ("test.rdf"), "RDF/XML-ABBREV");
} catch (RDFException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
-------------------------------------------

MOZILLA CODE :
-------------------------------------------
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>


<window id="jenaTest"
title="jenaTest"

xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
orient="vertical" >

<vbox>
<tree style="height : 200px"
id="navigationTree"
datasources="test.rdf"
ref="urn:root"
containment="urn:this.is.a.test/items">
<treecols>
<treecol id="navigationItem" label="" primary="true"
flex="100%"/>
</treecols>
<template>
<rule>
<conditions>
<content uri="?uri" />
<triple subject="?uri"
predicate="urn:this.is.a.test/items"
object="?items" />
<member container="?items" child="?item" />
<triple subject="?item"
predicate="http://purl.org/dc/elements/1.0/title"
object="?title" />
</conditions>
<action>
<treechildren>
<treeitem uri="?item" open="true">
<treerow>
<treecell label="?title" />
</treerow>
</treeitem>
</treechildren>
</action>
</rule>
</template>
</tree>
</vbox>
</window>
-------------------------------------------



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/xaxhjB/hdqFAA/VygGAA/NhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
jena-dev-unsubscribe@yahoogroups.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
Received on Wednesday, 9 April 2003 07:07:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:17:29 GMT