简体   繁体   中英

Index json file to fedora 4 using apache camel

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.

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/");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM