iovka / shex-java

Validation of Shape Expression Schemas
GNU Lesser General Public License v3.0
10 stars 6 forks source link

The README contains wrong Java namespace #3

Closed pkiraly closed 6 years ago

pkiraly commented 6 years ago

Dear developers,

the README contains an example, how to run the software, i.e.:

mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass="fr.univLille.cristal.shex.commandLine.Validate" -Dexec.args="-s ../../shexTest/schemas/1dotSemi.shex -d file:///home/jdusart/Documents/Shex/workspace/shexTest/validation/Is1_Ip1_Io1.ttl -l http://a.example/S1 -f http://a.example/s1 -a recursive"

According to this, the Java class is fr.univLille.cristal.shex.commandLine.Validate, however in your basic namespace is fr.inria.lille.shexjava.

I have another question: Do you have examples for running the software from the command line without Maven, such as:

java -jar shexjava-core-1.0.jar validate [parameters]

?

I tried this way:

java -cp target/shexjava-core-1.0.jar:[additional jars] \ 
  fr.inria.lille.shexjava.commandLine.Validate \
  -s ../../shexTest/schemas/1dotSemi.shex \
  -d file:////[path to]/validation/Is1_Ip1_Io1.ttl \
  -l http://a.example/S1 -f http://a.example/s1 -a recursive

and what I get:

Error while reading the data file.
Caused by: 
Did not recognise RDF format object Turtle (mimeTypes=text/turtle, application/x-turtle; ext=ttl)
Was unable to the parse data. Aborting.
jdusart commented 6 years ago

The namespace changed recently. fr.univLille.cristal.shex is now fr.inria.lille.shexjava.

I don't have example without maven, but it should be really similar. I think there is a problem with the url of the file. You have written file:////[path to]/validation/Is1_Ip1_Io1.ttl and I think there is too many / at the beginning. For the url it is file:// then followed by the absolute path to your file. Can you try that and if it doesn't work can you give me the full URL that you are using?

pkiraly commented 6 years ago

Thanks for the response!

My suggestion is that you should update the README file accordingly.

I got the same response even if I put three '/'-s. The file points to the [git]/shexTest/validation/Is1_Ip1_Io1.ttl file (where [git] is the absolute path of the parent directory of the cloned shexTest project). If I remove the file:// protocol notation I get a different error mesage:

Error while reading the data file.
Caused by: 
no protocol: [git]/shexTest/validation/Is1_Ip1_Io1.ttl
Was unable to the parse data. Aborting.
jdusart commented 6 years ago

I have updated the readme.

Can you try running the following command and give me the output?

mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass="fr.inria.lille.shexjava.commandLine.Validate" -Dexec.args="-s ../../shexTest/schemas/1dotSemi.shex -d https://raw.githubusercontent.com/shexSpec/shexTest/master/validation/Is1_Ip1_Io1.ttl -l http://a.example/S1 -f http://a.example/s1 -a recursive"
pkiraly commented 6 years ago

Sure, this is what I get:

Validating graph https://raw.githubusercontent.com/shexSpec/shexTest/master/validation/Is1_Ip1_Io1.ttl against schema ../../shexTest/schemas/1dotSemi.shex.
Typing constructed.
http://a.example/s1 SATISFIES IRI:http://a.example/S1

And also, if I use file:///... notation in this command I received the same output. I received the error when I try to use it without maven, with pure Java. Maybe this part is handled by a Java library which I did not include into the classpath.

jdusart commented 6 years ago

So I guess the next step is to try using the same classpath as maven. After some search, you can print it using the command:

mvn dependency:build-classpath -Dmdep.includeScope=runtime 

Otherwise, the parsing of the data is done by the following code:

import org.eclipse.rdf4j.rio.RDFFormat;
import org.eclipse.rdf4j.rio.Rio;

...

java.net.URL documentUrl = new URL(dataFileName);
InputStream inputStream = documentUrl.openStream();
dataModel  = Rio.parse(inputStream, documentUrl.toString(), RDFFormat.TURTLE);
jdusart commented 6 years ago

So I managed to make it works using the following command lines:

mvn dependency:build-classpath -Dmdep.includeScope=runtime -Dmdep.outputFile=cp.txt
SHEXCP="target/shexjava-core-1.1.jar:"`cat cp.txt`
java -cp $SHEXCP fr.inria.lille.shexjava.commandLine.Validate -s ../../shexTest/schemas/1dotSemi.shex -d https://raw.githubusercontent.com/shexSpec/shexTest/master/validation/Is1_Ip1_Io1.ttl   -l http://a.example/S1 -f http://a.example/s1 -a recursive

This produces the following output:

log4j:WARN No appenders could be found for logger (org.eclipse.rdf4j.rio.RDFParserRegistry).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Validating graph https://raw.githubusercontent.com/shexSpec/shexTest/master/validation/Is1_Ip1_Io1.ttl against schema ../../shexTest/schemas/1dotSemi.shex.
Typing constructed.
<http://a.example/s1> SATISFIES IRI:<http://a.example/S1>

Do you manage to reproduces it?

pkiraly commented 6 years ago

It works this way. Thanks a lot!

jdusart commented 6 years ago

You are welcome. I am closing this issue if you don't have anything to add?

pkiraly commented 6 years ago

No, I don't have. You can close it.