Index json file to fedora 4 using apache camel

63 views Asked by At

I try to move data from json file to fedora 4, using aoache camel and following code routine.

    XPathBuilder xpath = new 
 XPathBuilder("/rdf:RDF/rdf:Description/rdf:type[@rdf:resource='http://fedora.info/definitions/v4/indexing#Indexable']");
        xpath.namespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
            from("file:data/solr?noop=true")
                    .process(Utils.javascript("convert.js"))
                    .to("file:data2");

            from("file:data2?noop=true")
                    .unmarshal(gsonDataFormat)
                    .setBody().simple("${body.products}")
                    .split().body()
                    .setHeader(SolrConstants.OPERATION, constant(SolrConstants.OPERATION_ADD_BEAN))
            .to("fcrepo://10.46.3.100:8080/fcrepo-webapp-4.7.4/rest/");

Code works fine, i didn't get any mistake, but at the same time it doesn't indexes in fedora 4 repository.

1

There are 1 answers

0
andy_bu On

You should use json-ld instead json. The code can be following:

 from("file:data")
                    .setHeader(Exchange.HTTP_METHOD, constant("POST"))
                    .setHeader(Exchange.CONTENT_TYPE, constant("application/ld+json"))
                    .to("fcrepo:localhost:8080/fcrepo/rest/");