On 21/04/14 17:09, Lebling, David (US SSA) wrote:
I'm attempting to write a new graph into my TDB repository. The graph has the name of the
instance it represents, in this case, "http://anchor/plan#Graph1".
Deep below DatasetAccessor.putModel(), I get the following error:
com.hp.hpl.jena.shared.BadURIException: Only well-formed absolute URIrefs can be
included in RDF/XML output: <> Code: 57/REQUIRED_COMPONENT_MISSING in SCHEME: A
component that is required by the scheme is missing.
Placing a breakpoint where the exception is thrown reveals that
BaseXMLWrite.checkURI has been given an empty String.
So, I looked for empty URI strings in the Model being written, at least as
represented in Eclipse's toString() output. I'm not sure what format(s) the
following is in, but I see empty subjects in some triples, all of which are
associated with the ontology imports. (It has been edited to remove proprietary
info):
<ModelCom
{ @owl:imports http://www.w3.org/2003/01/geo/wgs84_pos;
@owl:imports http://anchor/OntS;
@owl:imports http://anchor/OntC;
@owl:imports http://anchor/OntA;
@owl:imports http://anchor/Core;
@rdf:type owl:Ontology;
http://anchor/plan#Graph1 @cc:meta_modifiedTime
"2014-04-21T15:23:40.427Z"^^http://www.w3.org/2001/XMLSchema#dateTime;
http://anchor/plan#Graph1 @cc:meta_createdTime
"2014-04-21T15:23:40.427Z"^^http://www.w3.org/2001/XMLSchema#dateTime;
.....
http://anchor/plan#Graph1 @rdf:type OntS:SObject} |
[, http://www.w3.org/2002/07/owl#imports,
http://www.w3.org/2003/01/geo/wgs84_pos]
[, http://www.w3.org/2002/07/owl#imports, http://anchor/OntS]
[, http://www.w3.org/2002/07/owl#imports, http://anchor/OntC]
[, http://www.w3.org/2002/07/owl#imports, http://anchor/OntA]
[, http://www.w3.org/2002/07/owl#imports, http://anchor/Core]
[, http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
http://www.w3.org/2002/07/owl#Ontology]
[http://anchor/plan#Graph1, http://anchor/Core#meta_modifiedTime,
"2014-04-21T15:23:40.427Z"^^http://www.w3.org/2001/XMLSchema#dateTime]
[http://anchor/plan#Graph1, http://anchor/Core#meta_createdTime,
"2014-04-21T15:23:40.427Z"^^http://www.w3.org/2001/XMLSchema#dateTime]
.....
[http://anchor/plan#Graph1, http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
http://anchor/OntS#SObject]>
Any ideas?
The URI for your OWL ontology is the empty string which is illegal and
can't be written out.
The OWL convention of using <> as the relative URI for an ontology in
source XML is fine but when you read it in it will get converted into an
absolute URI (that of the source URL you read it in from). So you don't
end up with an empty subject URI for your owl:imports in the Jena model.
If you want to create an ontology programatically and generate <> in
youir output then you create the owl:Ontology with some known BASE_URI
and then use the same BASE_URI as the base when writing out. The
RDF/XML-Abbrev writer will generate relative URIs in the output in that
case.
Dave