You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Håvard Ottestad (JIRA)" <ji...@apache.org> on 2013/11/28 16:58:35 UTC
[jira] [Created] (JENA-598) SPARQL Load requires correct http
content-type, should fall back to file ending
Håvard Ottestad created JENA-598:
------------------------------------
Summary: SPARQL Load requires correct http content-type, should fall back to file ending
Key: JENA-598
URL: https://issues.apache.org/jira/browse/JENA-598
Project: Apache Jena
Issue Type: Bug
Components: Jena
Affects Versions: Fuseki 1.0.0
Reporter: Håvard Ottestad
Priority: Trivial
Fix For: Fuseki 1.0.1
A SPARQL Update query with a LOAD command requires a correct HTTP content-type (mime-type) to be returned with the GET request when downloading the file.
Should have 2 failovers:
1. Attempt to use file ending. .ttl == TTL .xml == RDF/XML and so on
2. Attempt to read the file with a different language (eg. if TTL fails, try RDF/XML)
The code for this seems to be here: https://svn.apache.org/repos/asf/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineWorker.java
@Override
public void visit(UpdateLoad update)
{
String source = update.getSource() ;
Node dest = update.getDest() ;
try {
// Read into temporary storage to protect against parse errors.
TypedInputStream s = RDFDataMgr.open(source) ;
Lang lang = RDFLanguages.contentTypeToLang(s.getContentType()) ; //--- THIS IS WHERE THE BUG IS ---//
if ( RDFLanguages.isTriples(lang) ) {
// Triples
Graph g = GraphFactory.createGraphMem() ;
StreamRDF stream = StreamRDFLib.graph(g) ;
RDFDataMgr.parse(stream, s, source) ;
Graph g2 = graph(graphStore, dest) ;
GraphUtil.addInto(g2, g) ;
} else {
// Quads
if ( dest != null )
throw new UpdateException("Attempt to load quads into a graph") ;
DatasetGraph dsg = DatasetGraphFactory.createMem() ;
StreamRDF stream = StreamRDFLib.dataset(dsg) ;
RDFDataMgr.parse(stream, s, source) ;
Iterator<Quad> iter = dsg.find() ;
for ( ; iter.hasNext() ; )
{
Quad q = iter.next() ;
graphStore.add(q) ;
}
}
} catch (RuntimeException ex)
{
if ( ! update.getSilent() )
{
if ( ex instanceof UpdateException )
throw (UpdateException)ex ;
throw new UpdateException("Failed to LOAD '"+source+"'", ex) ;
}
}
}
--
This message was sent by Atlassian JIRA
(v6.1#6144)