jena - how to use rdfcat from java code -
in jena api there class rdfcat ,it tool convert data file format ,it used commande line example , need execute tool inside java code , tried code failed .
public static void main(string[] args) { rdfcat rdf=new rdfcat(); string[] t={"-x f:/foaf.owl -out ttl"}; rdf.main(t); string string=rdf.getcheckedlanguage("owl"); system.out.println("************************************************************"); map<string,string> m=rdf.unabbreviate; iterator iterator =m.keyset().iterator(); while(iterator.hasnext())system.out.println(iterator.next()); system.out.println("************************************************************"); system.out.println(string); }
there's nothing jena specific this. command line arguments supposed array of various arguments, you're passing one. is,
string[] t={"-x f:/foaf.owl -out ttl"};
is array one string member. if you're going call rdfcat's main, you'd need do:
string[] t={"-x", "f:/foaf.owl", "-out", "ttl"};
that said, seems kind of strange thing do. easily, more flexibly, load input model , write out in format want.
Comments
Post a Comment