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

Unexpected error, Invalid resource: A, zsh: unknown file attribute: i #88

Open
mboursnell opened this issue Sep 1, 2023 · 9 comments
Open

Comments

@mboursnell
Copy link

Hi,

I am struggling to get collatex to work with the example json file. Can you help?

This is what I get (below)

Thanks,

Mike

Mike@MIKEs-M1-iMac collateX % java -jar collatex-tools-1.7.1.jar witnesses.json
Unexpected error
null
Mike@MIKEs-M1-iMac collateX % java -jar collatex-tools-1.7.1.jar witnesses.json A B
Error while parsing command line arguments (-h for usage instructions)
Invalid resource: A
Mike@MIKEs-M1-iMac collateX % java -jar collatex-tools-1.7.1.jar (witnesses.json A B)
zsh: unknown file attribute: i
Mike@MIKEs-M1-iMac collateX %

Mike@MIKEs-M1-iMac collateX % more witnesses.json
{
"witnesses" : [
{
"id" : "A",
"content" : "A black cat in a black basket"
},
{
"id" : "B",
"content" : "A black cat in a black basket"
},
{
"id" : "C",
"content" : "A striped cat in a black basket"
},
{
"id" : "D",
"content" : "A striped cat in a white basket"
}
]
}
witnesses.json (END)

@rhdekker
Copy link
Member

rhdekker commented Sep 1, 2023

The Nashorn JavaScript Engine has been removed from recent versions of Java, which breaks CollateX. You will need JDK8 for Mac M1, which you can find here: https://www.azul.com/downloads/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk#zulu (bottom of the page).

@mboursnell
Copy link
Author

OK, thanks. I installed JDK8 (see image attached), but it doesn't seem to have helped...

Mike@MIKEs-M1-iMac collateX % java --version
java 16.0.1 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
Mike@MIKEs-M1-iMac collateX %
Mike@MIKEs-M1-iMac collateX % java -jar collatex-tools-1.7.1.jar song_trees_55_files.json
Unexpected error
null
Mike@MIKEs-M1-iMac collateX % java -jar collatex-tools-1.7.1.jar song_trees_55_files.json A B
Error while parsing command line arguments (-h for usage instructions)
Invalid resource: A
Mike@MIKEs-M1-iMac collateX % java -jar collatex-tools-1.7.1.jar (song_trees_55_files.json A B)
zsh: unknown group
Mike@MIKEs-M1-iMac collateX %

Screenshot 2023-09-01 at 18 23 04

@rhdekker
Copy link
Member

rhdekker commented Sep 1, 2023

You are half way there. It's still calling on the previously installed version of Java (16), instead of 8. Follow the "Set JAVA_HOME environment variable" instructions listed in this guide, https://dev.to/shane/configure-m1-mac-to-use-jdk8-with-maven-4b4g That should fix the problem.

@rhdekker
Copy link
Member

rhdekker commented Sep 1, 2023

If you want more background information on setting your JAVA_HOME variable, see here: https://stackoverflow.com/questions/21964709/how-to-set-or-change-the-default-java-jdk-version-on-macos

@mboursnell
Copy link
Author

That works! Thanks.

How do you select two of the four witnesses? I tried various things... What is the syntax?

Mike@MIKEs-M1-iMac collateX % java -jar collatex-tools-1.7.1.jar witnesses.json
{"witnesses":["A","B","C","D"],"table":[[["A "],["A "],["A "],["A "]],[["black "],["black "],["striped "],["striped "]],[["cat ","in ","a "],["cat ","in ","a "],["cat ","in ","a "],["cat ","in ","a "]],[["black "],["black "],["black "],["white "]],[["basket"],["basket"],["basket"],["basket"]]]}%
Mike@MIKEs-M1-iMac collateX %
Mike@MIKEs-M1-iMac collateX %
Mike@MIKEs-M1-iMac collateX % java -jar collatex-tools-1.7.1.jar witnesses.json A B
Error while parsing command line arguments (-h for usage instructions)
Invalid resource: A
Mike@MIKEs-M1-iMac collateX %

@rhdekker
Copy link
Member

rhdekker commented Sep 1, 2023

Glad to hear that it worked. As far as I remember there is no witness selection syntax. You can either pre filter the input before sending it to CollateX or post process the output. The idea is that the JSON is already a derivative of some other input file or files, like plain text, XML or a database.

@mboursnell
Copy link
Author

OK, thanks. That'll be fine. I can work with that. Looking forward to trying it...

But the help suggests that you can (or have I misread it? I'm not sure what "|" and "(" mean)

Mike@MIKEs-M1-iMac collateX % java -jar collatex-tools-1.7.1.jar -h
usage: collatex []
(<json_input> | <witness_1> <witness_2> [[<witness_3>] ...])
-a,--algorithm progressive alignment algorithm to
use 'dekker' (default), 'medite',
'needleman-wunsch'
-cp,--context-path URL base/context path of the
service, default: '/'
-dot,--dot-path path to Graphviz 'dot',
auto-detected by default
-f,--format result/output format: 'json', 'csv',
'dot', 'graphml', 'tei'
-h,--help print usage instructions
-ie,--input-encoding charset to use for decoding non-XML
witnesses; default: UTF-8
-mcs,--max-collation-size maximum number of characters
(counted over all witnesses) to
perform collations on, default:
unlimited
-mpc,--max-parallel-collations maximum number of collations to
perform in parallel, default: 2
-o,--output output file; '-' for standard output
(default)
-oe,--output-encoding charset to use for encoding the
output; default: UTF-8
-p,--port HTTP port to bind server to,
default: 7369
-s,--script ECMA/JavaScript resource with
functions to be plugged into the
alignment algorithm
-S,--http start RESTful HTTP server
-t,--tokenized consecutive matches of tokens will
not be joined to segments
-xml,--xml-mode witnesses are treated as XML
documents
-xp,--xpath XPath 1.0 expression evaluating to
tokens of XML witnesses; default:
'//text()'

@rhdekker
Copy link
Member

rhdekker commented Sep 1, 2023

What I think is meant is that you can either supply a single JSON file that supplies all the witnesses or a list of file names of plain text files. As in java -jar collatex-tools-1.7.1.jar plain_text_witness1.txt witness2.txt witness3.txt

@mboursnell
Copy link
Author

Ah! I see. Thanks.
Thanks for all your help.
I'll try using it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants