Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with LocalFileAccess:getInputStream when file is not absolute #156

Open
shawnhind opened this issue Apr 5, 2022 · 2 comments
Open
Labels
bug Something isn't working more-information-needed

Comments

@shawnhind
Copy link

shawnhind commented Apr 5, 2022

My mapping file just had the logical source someFile.csv. I pointed the RecordsFactory class to the path where I had this file on my system. In my case it was in /tmp/ directory.

When the process would get to LocalFileAccess:getInputStream it would fail on line 40 calling org.apache.commons.io.FileUtils.getFile with a MethodNotFound exception for String[]. In this case it was trying to pass it the base path and the path. This however failed.

If I instead changed my mapping file to have the full path /tmp/someFile.csv it then worked, however I was not able to get it to work using a relative path.

When this method was being called:

this.path on the LocalFileAccess object was: "someFile.csv"
this.basePath on the LocalFileAccess object was "/tmp/"

java.io.File org.apache.commons.io.FileUtils.getFile(java.lang.String[])': java.lang.NoSuchMethodError
java.lang.NoSuchMethodError: 'java.io.File org.apache.commons.io.FileUtils.getFile(java.lang.String[])'
	at be.ugent.rml.access.LocalFileAccess.getInputStream(LocalFileAccess.java:40)
	at be.ugent.rml.records.CSVRecordFactory.getRecordsForCSV(CSVRecordFactory.java:144)
	at be.ugent.rml.records.CSVRecordFactory.getRecords(CSVRecordFactory.java:63)
	at be.ugent.rml.records.RecordsFactory.getRecords(RecordsFactory.java:137)
	at be.ugent.rml.records.RecordsFactory.createRecords(RecordsFactory.java:71)
	at be.ugent.rml.Executor.getRecords(Executor.java:429)
	at be.ugent.rml.Executor.executeWithFunctionV5(Executor.java:165)
	at be.ugent.rml.Executor.executeV5(Executor.java:152)
	at be.ugent.rml.Executor.executeV5(Executor.java:250)
	at rml.RmlMappingUtils.rmlProcess(RmlMappingUtils.java:126)
	at rml.RmlMappingUtils.handleRequest(RmlMappingUtils.java:56)
@DylanVanAssche DylanVanAssche added the bug Something isn't working label May 11, 2022
@DylanVanAssche
Copy link
Contributor

Hi @shawnhind !

Thanks for your issue! This seems like an issue with how the paths to files are resolved when using relative paths.
Do you have the mapping file and CSV file still?

@jheus
Copy link

jheus commented Jul 12, 2022

We have the same issue. When setting -mappingfile to a subdirectory and place the data files in that same subdirectory we have the same error. The mappingfile is found and being parsed, but the files are not found there (the csvw:url is not having relative paths):

<#Arbeidsovereenkomst>
    a rr:TriplesMap;
    rml:logicalSource [
    	rml:source [
			a csvw:Table;
			csvw:url "Dienstverband.txt" ;
			csvw:dialect [ 
				a csvw:Dialect;
				csvw:delimiter ";"
			]
		];
    	rml:referenceFormulation ql:CSV;
    ];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working more-information-needed
Projects
None yet
Development

No branches or pull requests

3 participants