Could someone explain this to me?
Given this code:
Model model_ = ModelFactory.createDefaultModel();
String uri = new URI("http://foo/contentA/version#").toString();
model_.setNsPrefix("a", uri);
model_.setNsPrefix("l",
com.hp.hpl.jena.vocabulary.RDFS.label.getURI());
Resource source = model_.getResource(uri +
"951d9b63-bc07-3e58-bbb4-8dffd26e57f1");
Resource target = model_.getResource(uri +
"a51d9b63-bc07-3e58-bbb4-8dffd26e57f1");
Statement s = model_.createStatement(source,
com.hp.hpl.jena.vocabulary.RDFS.label, target);
model_.add(s);
RDFWriter rdfWriter = model_.getWriter("N3-TRIPLE");
File file = new File("export.n3");
OutputStream out = new FileOutputStream(file);
rdfWriter.write(model_, out, null);
out.close();
Jena outputs the following:
@prefix a: <http://foo/contentA/version#> .
@prefix l: <http://www.w3.org/2000/01/rdf-schema#label> .
<http://foo/contentA/version#951d9b63-bc07-3e58-bbb4-8dffd26e57f1>
<http://www.w3.org/2000/01/rdf-schema#label>
a:a51d9b63-bc07-3e58-bbb4-8dffd26e57f1 .
You will notice that it uses the prefix for one of my values, but not
the other. The only difference between these values is one of them
starts with a number, and the other doesn't.
Does a fragment really have to start with a letter? Is this a bug?
Or a feature?
Also, you can see that I tried to make it write a prefix for the label
to shorten the output... but that didn't work either. Is there a way
to do that?
Thanks,
Dan