I get the parse error message with that code.

You can force the use of, say RDF/XML, by opening the connection directly with HttpOp. You then have to tell the parse the syntax and base URI:

try {
    Graph g = GraphFactory.createDefaultGraph();
    String uri = "http://dbpedia.org/resource/Rome";;
try ( TypedInputStream in = HttpOp.execHttpGet(uri, "application/rdf+xml") ) {
        RDFDataMgr.read(g, in, uri, Lang.RDFXML);
    }
    System.out.println("size " + g.size());
} catch (Throwable e) {
    System.err.println(e);
}

==>

size 8142

        Andy

On 19/01/17 16:52, Jean-Marc Vanel wrote:
import org.apache.jena.graph.Graph;
import org.apache.jena.riot.RDFDataMgr;

public class ReadMgr {
    public static void main(String[] args) {
        try {
            Graph g = RDFDataMgr.loadGraph("http://dbpedia.org/resource/Rome
");
            System.out.println("size " + g.size());
        } catch (Throwable e) {
            System.err.println(e);
        }
    }
}

Reply via email to