I m trying to access a rdf file from the google nexus…..(now this code is able to access the rdf file from disc)….as google nexus doesnt have sdcard slot…..so I am having the problem to define the path from where the rdf file will be retrieved….
public class andro extends Activity implements View.OnClickListener{
/** Called when the activity is first created. */
Graph graph;
Load ld;
Mappings map;
QueryProcess exec;
ResultFormat f;
RDFFormat f3;
Button runbtn;
Button clearbtn;
Button test;
Button triple;
EditText et1;
TextView tv1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.query);
clearbtn = (Button) findViewById(R.id.clear) ;
runbtn = (Button) findViewById(R.id.run);
test = (Button) findViewById(R.id.test);
triple = (Button) findViewById(R.id.rdf);
tv1 = (TextView) findViewById(R.id.output);
et1 = (EditText) findViewById(R.id.input);
clearbtn.setOnClickListener(new OnClickListener(){
public void onClick(View v){
et1.setText("");
tv1.setText("");
}
});
test.setOnClickListener(new OnClickListener(){
//runbtn.setOnClickListener(new OnClickListener(){
public void onClick(View v){
/* String op = et1.getText().toString();
tv1.setText(op);
*/
// graph = Graph.create();
graph = Graph.create(true);
ld = Load.create(graph);
ld.load("/user/roy/home/DownLoad/foaf.rdf");
// ld.load("dataset.rdf");
/*
try {
ld.loadWE("dataset.rdf");
} catch (LoadException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
*/
// String query = null;
// Mappings map = null;
// String query1 = "select * where {?x ?p ?y}";
exec = QueryProcess.create(graph);
query1 = et1.getText().toString();
try {
map = exec.query(query1);
} catch (EngineException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// f = ResultFormat.create(map);
// f3 = TripleFormat.create(map);
String f2 = ld.toString();
tv1.setText(ld);
//System.out.println(f2);
}
});
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
}
Thanks in advance….
While the Nexus doesnt have a REMOVABLE sd card, it basically still has an internal one. Therefore, with the external storage, you can just treat it like you normally would if you could remove the SD card: