Giter VIP home page Giter VIP logo

Comments (8)

bjdmeest avatar bjdmeest commented on September 3, 2024

Hi,

The executor.execute-command returns a QuadStore, which has a write method that takes the format as one of the parameters. For example, the snippet below writes the output as jsonld to stdout.

QuadStore result = executor.execute(triplesMaps, checkOptionPresence(removeduplicatesOption, lineArgs, configFile), metadataGenerator);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
result.write(out, "jsonld");

Does this help?

from rmlmapper-java.

venkateshzifo avatar venkateshzifo commented on September 3, 2024

Thanks for the response.

Yeah that's what I am looking for. But its not working

It throws Serialization jsonld not supported when I try to write the output as jsonld.

from rmlmapper-java.

bjdmeest avatar bjdmeest commented on September 3, 2024

Ah, could it be that you are using a SimpleQuadStore instead of a RDF4JStore when creating the Executor?

Executor executor = new Executor(rmlStore, factory, functionLoader, outputStore, Utils.getBaseDirectiveTurtle(is));

The outputStore of this line should be an RDF4JStore.

from rmlmapper-java.

venkateshzifo avatar venkateshzifo commented on September 3, 2024

I am using below code snippet. I am using RDF4JStore only.

                InputStream mappingStream = new FileInputStream(mappingFile);

		Model model = Rio.parse(mappingStream, "", RDFFormat.TURTLE);

		RDF4JStore outputStore = new RDF4JStore(model);

		Executor executor = new Executor(outputStore, new RecordsFactory(new DataFetcher(cwd, outputStore)));

		QuadStore chromResult = executor.execute(executor.getTriplesMaps());

		chromResult.removeDuplicates();

		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
		
                chromResult.write(out, "jsonld");`

from rmlmapper-java.

bjdmeest avatar bjdmeest commented on September 3, 2024

Ah, yes, there's a bit of confusion here: you need QuadStore for your RML mapping, and a second QuadStore for your output data. You can check https://github.com/RMLio/rmlmapper-java/blob/master/src/main/java/be/ugent/rml/cli/Main.java for more details, but I guess you need something along the lines of

// Read mapping file
InputStream mappingStream = new FileInputStream(mappingFile);
Model model = Rio.parse(mappingStream, "", RDFFormat.TURTLE);
RDF4JStore rmlStore= new RDF4JStore(model);
// Load functions
FunctionLoader functionLoader = new FunctionLoader(null, null, new HashMap<>());
// Prepare output store
RDF4JStore outputStore = new RDF4JStore();
// Create executor
Executor executor = new Executor(rmlStore, new RecordsFactory(new DataFetcher(cwd, rmlStore)),functionLoader, outputStore, Utils.getBaseDirectiveTurtle(mappingStream ));
// Execute
QuadStore chromResult = executor.execute(executor.getTriplesMaps());
chromResult.removeDuplicates();
// Write result
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
chromResult.write(out, "jsonld");`

from rmlmapper-java.

venkateshzifo avatar venkateshzifo commented on September 3, 2024

I am facing new problem with this code. Utils.getBaseDirectiveTurtle is not available method in Utils class. Is this from be.ugent.rml.Utils class ?

from rmlmapper-java.

bjdmeest avatar bjdmeest commented on September 3, 2024

Indeed, please see https://github.com/RMLio/rmlmapper-java/blob/master/src/main/java/be/ugent/rml/cli/Main.java for the imports

from rmlmapper-java.

venkateshzifo avatar venkateshzifo commented on September 3, 2024

Thanks, It worked, the problem is, I was using older jar. Thanks for helping out :)

from rmlmapper-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.