本文整理汇总了Java中eu.fbk.utils.core.CommandLine类的典型用法代码示例。如果您正苦于以下问题:Java CommandLine类的具体用法?Java CommandLine怎么用?Java CommandLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CommandLine类属于eu.fbk.utils.core包,在下文中一共展示了CommandLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
try {
// Parse command line
final CommandLine cmd = provideParameterList().parse(args);
final String output = cmd.getOptionValue(OUTPUT, String.class);
final String consumerKey = cmd.getOptionValue(CONSUMER_KEY, String.class);
final String consumerSecret = cmd.getOptionValue(CONSUMER_SECRET, String.class);
GetSuggestions script = new GetSuggestions(consumerKey, consumerSecret);
script.run(output);
} catch (final Throwable ex) {
// Handle exception
CommandLine.fail(ex);
}
}
示例2: main
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
try {
// Parse command line
final CommandLine cmd = provideParameterList().parse(args);
final String endpointUri = cmd.getOptionValue(ENDPOINT, String.class);
final String workingFile = cmd.getOptionValue(WORKING, String.class);
Endpoint endpoint = new Endpoint(endpointUri);
CleanupGold script = new CleanupGold(endpoint);
script.run(workingFile);
} catch (final Throwable ex) {
// Handle exception
CommandLine.fail(ex);
}
}
示例3: provideParameterList
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
private static CommandLine.Parser provideParameterList() {
return CommandLine.parser()
.withOption("c", DB_CONNECTION,
"connection string for the database", "DB",
CommandLine.Type.STRING, true, false, true)
.withOption(null, DB_USER,
"user for the database", "USER",
CommandLine.Type.STRING, true, false, true)
.withOption(null, DB_PASSWORD,
"password for the database", "PASSWORD",
CommandLine.Type.STRING, true, false, true)
.withOption(null, ENDPOINT,
"URL to SPARQL endpoint", "ENDPOINT",
CommandLine.Type.STRING, true, false, true)
.withOption("w", WORKING,
"Input file with entities", "INPUT",
CommandLine.Type.STRING, true, false, true)
.withOption(null, LSA_PATH,
"path to LSA model", "DIRECTORY",
CommandLine.Type.STRING, true, false, true);
}
示例4: main
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
try {
// Parse command line
final CommandLine cmd = provideParameterList().parse(args);
final String dbConnection = cmd.getOptionValue(DB_CONNECTION, String.class);
final String dbUser = cmd.getOptionValue(DB_USER, String.class);
final String dbPassword = cmd.getOptionValue(DB_PASSWORD, String.class);
final String endpointUri = cmd.getOptionValue(ENDPOINT, String.class);
final String workingDir = cmd.getOptionValue(WORKING, String.class);
final String lsaPath = cmd.getOptionValue(LSA_PATH, String.class);
DataSource source = DBUtils.createPGDataSource(dbConnection, dbUser, dbPassword);
Endpoint endpoint = new Endpoint(endpointUri);
FileProvider provider = new FileProvider(workingDir);
Scaler scaler = new Gson().fromJson(new FileReader(provider.scaler), Scaler.class);
ScoringStrategy strategy = new ISWC17Strategy(source, lsaPath);
ScoreEntities script = new ScoreEntities(source, endpoint, scaler, strategy);
script.run();
} catch (final Throwable ex) {
// Handle exception
CommandLine.fail(ex);
}
}
示例5: provideParameterList
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
private static CommandLine.Parser provideParameterList() {
return CommandLine.parser()
.withOption("c", DB_CONNECTION,
"connection string for the database", "DB",
CommandLine.Type.STRING, true, false, true)
.withOption(null, DB_USER,
"user for the database", "USER",
CommandLine.Type.STRING, true, false, true)
.withOption(null, DB_PASSWORD,
"password for the database", "PASSWORD",
CommandLine.Type.STRING, true, false, true)
.withOption(null, ENDPOINT,
"URL to SPARQL endpoint", "ENDPOINT",
CommandLine.Type.STRING, true, false, true)
.withOption(null, INPUT,
"Input file with entities", "INPUT",
CommandLine.Type.STRING, true, false, true);
}
示例6: main
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
try {
// Parse command line
final CommandLine cmd = provideParameterList().parse(args);
final String dbConnection = cmd.getOptionValue(DB_CONNECTION, String.class);
final String dbUser = cmd.getOptionValue(DB_USER, String.class);
final String dbPassword = cmd.getOptionValue(DB_PASSWORD, String.class);
final String endpointUri = cmd.getOptionValue(ENDPOINT, String.class);
final String input = cmd.getOptionValue(INPUT, String.class);
DataSource source = DBUtils.createPGDataSource(dbConnection, dbUser, dbPassword);
Endpoint endpoint = new Endpoint(endpointUri);
SubmitEntities script = new SubmitEntities(source, endpoint);
script.run(input);
} catch (final Throwable ex) {
// Handle exception
CommandLine.fail(ex);
}
}
示例7: main
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
try {
// Parse command line
final CommandLine cmd = provideParameterList().parse(args);
final String dbConnection = cmd.getOptionValue(DB_CONNECTION, String.class);
final String dbUser = cmd.getOptionValue(DB_USER, String.class);
final String dbPassword = cmd.getOptionValue(DB_PASSWORD, String.class);
DataSource source = DBUtils.createPGDataSource(dbConnection, dbUser, dbPassword);
DumpResource script = new DumpResource(source);
script.run();
} catch (final Throwable ex) {
// Handle exception
CommandLine.fail(ex);
}
}
示例8: provideParameterList
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
private static CommandLine.Parser provideParameterList() {
return CommandLine.parser()
.withOption("c", DB_CONNECTION,
"connection string for the database", "DB",
CommandLine.Type.STRING, true, false, true)
.withOption(null, DB_USER,
"user for the database", "USER",
CommandLine.Type.STRING, true, false, true)
.withOption(null, DB_PASSWORD,
"password for the database", "PASSWORD",
CommandLine.Type.STRING, true, false, true)
.withOption(null, ENDPOINT,
"URL to SPARQL endpoint", "ENDPOINT",
CommandLine.Type.STRING, true, false, true)
.withOption(null, QUERY,
"Query", "QUERY",
CommandLine.Type.STRING, true, false, false);
}
示例9: main
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
try {
// Parse command line
final CommandLine cmd = provideParameterList().parse(args);
final String dbConnection = cmd.getOptionValue(DB_CONNECTION, String.class);
final String dbUser = cmd.getOptionValue(DB_USER, String.class);
final String dbPassword = cmd.getOptionValue(DB_PASSWORD, String.class);
final String endpointUri = cmd.getOptionValue(ENDPOINT, String.class);
String query = cmd.getOptionValue(QUERY, String.class);
if (query == null) {
query = "http://wikidata.dbpedia.org/resource/Q359442";
}
FullyResolvedEntry entry = new FullyResolvedEntry(new DatasetEntry(query, null));
new FillFromIndex(new Endpoint(endpointUri), new AllNamesStrategy(), dbConnection, dbUser, dbPassword).fill(entry);
LOGGER.info("List of candidates for entity: "+entry.entry.resourceId);
for (User candidate : entry.candidates) {
LOGGER.info(" "+candidate.getName()+" (@"+candidate.getScreenName()+")");
}
} catch (final Throwable ex) {
// Handle exception
CommandLine.fail(ex);
}
}
示例10: provideParameterList
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
private static CommandLine.Parser provideParameterList() {
return CommandLine.parser()
.withOption("c", DB_CONNECTION,
"connection string for the database", "DB",
CommandLine.Type.STRING, true, false, true)
.withOption(null, DB_USER,
"user for the database", "USER",
CommandLine.Type.STRING, true, false, true)
.withOption(null, DB_PASSWORD,
"password for the database", "PASSWORD",
CommandLine.Type.STRING, true, false, true)
.withOption(null, ENDPOINT,
"URL to SPARQL endpoint", "ENDPOINT",
CommandLine.Type.STRING, true, false, true)
.withOption(null, LSA_PATH,
"path to LSA model", "DIRECTORY",
CommandLine.Type.STRING, true, false, true)
.withOption(null, QUERY,
"Query", "QUERY",
CommandLine.Type.STRING, true, false, false);
}
示例11: main
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
try {
// Parse command line
final CommandLine cmd = provideParameterList().parse(args);
final String dbConnection = cmd.getOptionValue(DB_CONNECTION, String.class);
final String dbUser = cmd.getOptionValue(DB_USER, String.class);
final String dbPassword = cmd.getOptionValue(DB_PASSWORD, String.class);
final String endpointUri = cmd.getOptionValue(ENDPOINT, String.class);
final String lsaPath = cmd.getOptionValue(LSA_PATH, String.class);
String query = cmd.getOptionValue(QUERY, String.class);
if (query == null) {
query = "http://wikidata.dbpedia.org/resource/Q359442";
}
DataSource source = DBUtils.createPGDataSource(dbConnection, dbUser, dbPassword);
LSM lsm = new LSM(lsaPath + "/X", 100, true);
UserLSAInteractive script = new UserLSAInteractive(new Endpoint(endpointUri), source, lsm);
script.run(query);
} catch (final Throwable ex) {
// Handle exception
CommandLine.fail(ex);
}
}
示例12: provideParameterList
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
private static CommandLine.Parser provideParameterList() {
return CommandLine.parser()
.withOption("c", DB_CONNECTION,
"connection string for the database", "DB",
CommandLine.Type.STRING, true, false, false)
.withOption(null, DB_USER,
"user for the database", "USER",
CommandLine.Type.STRING, true, false, false)
.withOption(null, DB_PASSWORD,
"password for the database", "PASSWORD",
CommandLine.Type.STRING, true, false, false)
.withOption("t", TWEETS_PATH,
"specifies the directory from which to get a stream of tweets", "DIRECTORY",
CommandLine.Type.STRING, true, false, true)
.withOption("r", RESULTS_PATH,
"specifies the directory to which the results will be saved (in this case the db params are not required)", "DIRECTORY",
CommandLine.Type.STRING, true, false, false);
}
示例13: main
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
BuildUserLSA extractor = new BuildUserLSA();
try {
// Parse command line
final CommandLine cmd = provideParameterList().parse(args);
//noinspection ConstantConditions
final Path tweetsPath = new Path(cmd.getOptionValue(TWEETS_PATH, String.class));
//noinspection ConstantConditions
final String results = cmd.getOptionValue(RESULTS_PATH, String.class);
//noinspection ConstantConditions
final String lsaPath = cmd.getOptionValue(LSA_PATH, String.class);
final Configuration parameters = new Configuration();
parameters.setString("db.file", results);
parameters.setString("lsa.file", lsaPath);
extractor.startPipeline(tweetsPath, parameters);
} catch (final Throwable ex) {
// Handle exception
CommandLine.fail(ex);
}
}
示例14: main
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
public static void main(final String... args) {
try {
final CommandLine cmd = CommandLine
.parser()
.withName("index-senticnet-lexicon")
.withHeader("Processes the RDF data of eu.fbk.dkm.pikes.resources.SenticNet, " //
+ "producing a TSV file with an indexed version of it that can " //
+ "be used with the eu.fbk.dkm.pikes.resources.SenticNet Java API class.")
.withOption("i", "input", "the input file name", "FILE", Type.FILE_EXISTING,
true, false, true)
.withOption("o", "output", "the output file name", "FILE", Type.FILE, true,
false, true) //
.withLogger(LoggerFactory.getLogger("eu.fbk")) //
.parse(args);
final File inputFile = cmd.getOptionValue("i", File.class);
final File outputFile = cmd.getOptionValue("o", File.class);
final SenticNet lexicon = index(inputFile.getAbsolutePath());
lexicon.writeTo(outputFile.getAbsolutePath());
} catch (final Throwable ex) {
CommandLine.fail(ex);
}
}
示例15: main
import eu.fbk.utils.core.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
final CommandLine cmd = CommandLine
.parser()
.withName("file-test")
.withHeader("Check eu.fbk.dkm.pikes.resources.mpqa file")
.withOption("i", "input-file", "the MPQA file", "FILE", CommandLine.Type.FILE_EXISTING, true, false, true)
.withLogger(LoggerFactory.getLogger("eu.fbk.fssa")).parse(args);
final File inputFile = cmd.getOptionValue("i", File.class);
final RecordSet annotations = RecordSet.readFromFile(inputFile);
for (Record record : annotations.getRecords()) {
System.out.println(record.getName());
System.out.println(record.getSpan());
for (String attr : record.getValueMap().keySet()) {
System.out.println(attr + " = " + record.getValueMap().get(attr));
}
System.out.println();
}
}