Did you really double-check the path to the file?!

The exception

> org.apache.jena.shared.NotFoundException: Not found:
> file:///C:/Users/Toshiba/AndroidStudioProjects/MyApplication/app/sampledata/MallOntology.owl

is clear enough. It might also be the case that once you run it as
Android application, the context is different from the local file
system. But it's your task to figure it out.


> Hello,
>  
> I have try the path that you gave me but it does not work i have the
> following error:
>
> Process: com.example.toshiba.myapplication, PID: 4431
>     org.apache.jena.shared.NotFoundException: Not found:
> file:///C:/Users/Toshiba/AndroidStudioProjects/MyApplication/app/sampledata/MallOntology.owl
>         at
> org.apache.jena.riot.adapters.AdapterFileManager.readModelWorker(AdapterFileManager.java:293)
>         at
> org.apache.jena.util.FileManager.loadModelWorker(FileManager.java:306)
>         at
> org.apache.jena.util.FileManager.loadModel(FileManager.java:259)
>         at
> com.example.toshiba.myapplication.MainActivity$3.onCompleted(MainActivity.java:245)
>         at com.facebook.GraphRequest$1.onCompleted(GraphRequest.java:301)
>         at com.facebook.GraphRequest$5.run(GraphRequest.java:1380)
>         at android.os.Handler.handleCallback(Handler.java:790)
>         at android.os.Handler.dispatchMessage(Handler.java:99)
>         at android.os.Looper.loop(Looper.java:164)
>         at android.app.ActivityThread.main(ActivityThread.java:6494)
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
> com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
>         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
>
> note if   i  insert the code in public static main(String[] arg) and i
> run the Main activity and not the app 
>  it work well but when i run the app it crash 
>
> NB: find attached image. Yes the file does exist  
>
> On Sat, Sep 15, 2018 at 11:37 AM Andy Seaborne <[email protected]
> <mailto:[email protected]>> wrote:
>
>
>
>     On 14/09/18 16:54, elio hbeich wrote:
>     >
>     >     Hello,
>     >
>     >     I have been generated rdf/xml file  from Pretege.
>     >     I am trying to load it in android studio by using the
>     following code:
>     >
>     >     Model m =
>     
> FileManager.get().loadModel("C:\\Users\\Toshiba\\AndroidStudioProjects\\MyApplication\\app\\sampledata\\MallOntology.owl")
>     ;
>     >
>     >     but I always get that the File Not exist.
>
>     Does the file really exist? And does it matter it is a windows format
>     file name?
>
>     If you are using Androjena, which is a 3rd part port for Jena, not
>     from
>     the Apache Jena project, it is based on a quite old version of Jena.
>
>     If that file exists, and if you use the windwos file synatx, try:
>
>     
> "file:///C:/Users/Toshiba/AndroidStudioProjects/MyApplication/app/sampledata/MallOntology.owl"
>
>     >
>     >     I am trying to insert data fetched from Facebook login the
>     source code is :
>     >
>     >     Model m =
>     
> FileManager.get().loadModel("C:\\Users\\Toshiba\\AndroidStudioProjects\\MyApplication\\app\\sampledata\\MallOntology.owl")
>     ;
>     >
>     >
>     >     String updateString ="PREFIX ns:
>     >   
>      
> <http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-60#>\n"
>     >     +
>     >     "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
>     >     "PREFIX owl: <http://www.w3.org/XML/1998/namespace#>\n" +
>     >     "PREFIX xml: <http://www.w3.org/XML/1998/namespace#>\n" +
>     >     "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n" +
>     >     "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
>     >     "PREFIX ts: <http://www.w3.org/2002/07/owl#>\n" +
>     >     "PREFIX ds:
>     >   
>      
> <http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-50#>\n"
>     >     +
>     >     "\n" +
>     >     "Insert data
>     >   
>      
> {<http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-60#";
>     >     +ID +"> rdf:type ds:User.\n" +
>     >   
>      
> "<http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-60#";
>     >     +ID +"> rdf:type ds:Personal.\n" +
>     >   
>      
> "<http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-60#";
>     >     +ID +"> rdf:type ts:NamedIndividual.\n" +
>     >   
>      
> "<http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-60#";
>     >     +ID +"> ns:First_Name \"" +FN +"\". \r\n" +
>     >   
>      
> "<http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-60#";
>     >     +ID +"> ns:Last_Name \"" +LN +"\". \r\n" +
>     >     //
>     >   
>      
> "<http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-60#"+id.getText().toString()+">
>     >     ns:Gender \""+gender.getText().toString()+"\". \r\n" +
>     >   
>      
> "<http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-60#";
>     >     +ID +"> ns:Username \"" +um +"\". \r\n" +
>     >   
>      
> "<http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-60#";
>     >     +ID +"> ns:Email \"" +em +"\". \r\n" +
>     >     //
>     >   
>      
> "<http://www.semanticweb.org/toshiba/ontologies/2018/6/untitled-ontology-60#"+id+";>
>     >     ns:Date_Of_Birth \""+birthday+"\". \r\n" +
>     >     " }";
>     >
>     >       UpdateAction.parseExecute(updateString, m);
>     >
>     >     try {
>     >     m.write(new
>     
> FileOutputStream("C:\\Users\\Toshiba\\AndroidStudioProjects\\MyApplication\\app\\sampledata\\MallOntology.owl"),"RDF/XML");
>     >     }catch (FileNotFoundException e) {
>     >     e.printStackTrace();
>     >     }
>     >
>     >     Do u have any idea how can i solve the problem?
>     >
>     >     the Android Manifest code is:
>     >
>     >     <?xml version="1.0" encoding="utf-8"?>
>     >     <manifest
>     xmlns:android="http://schemas.android.com/apk/res/android";
>     >     package="com.example.toshiba.myapplication">
>     >
>     >          <uses-permission
>     android:name="android.permission.READ_EXTERNAL_STORAGE"/>
>     >          <uses-permission
>     android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
>     >          <uses-permission
>     android:name="android.permission.INTERNET" />
>     >          <uses-permission
>     android:name="android.permission.ACCESS_NETWORK_STATE" />
>     >          <uses-permission
>     >     android:name="android.permission.ACCESS_COARSE_LOCATION" />
>     >          <uses-permission
>     android:name="android.permission.ACCESS_FINE_LOCATION" />
>     >          <uses-permission
>     android:name="android.permission.NETWORK" />
>     >          <uses-permission
>     android:name="android.permission.GET_ACCOUNTS" />
>     >          <uses-permission
>     android:name="android.permission.USE_CREDENTIALS" />
>     >
>     >          <application
>     >     android:allowBackup="true"
>     >     android:icon="@mipmap/ic_launcher"
>     >     android:label="@string/app_name"
>     >     android:roundIcon="@mipmap/ic_launcher_round"
>     >     android:supportsRtl="true"
>     >     android:theme="@style/AppTheme">
>     >
>     >
>     >
>     >              <activity
>     >     android:name=".MainActivity">
>     >                  <intent-filter>
>     >                      <action
>     android:name="android.intent.action.MAIN" />
>     >
>     >                      <category
>     android:name="android.intent.category.LAUNCHER" />
>     >                  </intent-filter>
>     >              </activity>
>     >
>     >              <meta-data
>     >     android:name="com.facebook.sdk.ApplicationId"
>     >     android:value="@string/facebook_app_id" />
>     >              <meta-data
>     >     android:name="com.google.android.gms.version"
>     >     android:value="@integer/google_play_services_version" />
>     >
>     >
>     >              <activity
>     >     android:name="com.facebook.FacebookActivity"
>     >   
>      
> android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
>     >     android:label="@string/app_name" />
>     >              <activity
>     >     android:name="com.facebook.CustomTabActivity"
>     >     android:exported="true">
>     >                  <intent-filter>
>     >                      <action
>     android:name="android.intent.action.VIEW" />
>     >
>     >                      <category
>     android:name="android.intent.category.DEFAULT" />
>     >                      <category
>     android:name="android.intent.category.BROWSABLE" />
>     >
>     >                      <data
>     android:scheme="@string/fb_login_protocol_scheme" />
>     >                  </intent-filter>
>     >              </activity>
>     >              <activity
>     >     android:name=".Main2Activity"
>     >     android:label="@string/title_activity_main2"
>     >     android:theme="@style/AppTheme.NoActionBar" />
>     >              <activity android:name=".personal_profile" />
>     >              <activity
>     >     android:name=".EventActivity"
>     >     android:label="@string/title_activity_event"
>     >     android:theme="@style/AppTheme.NoActionBar" />
>     >              <activity
>     >     android:name=".PreferenceActivity"
>     >     android:label="@string/title_activity_preference" />
>     >              <activity android:name=".Main3Activity" />
>     >              <activity
>     >     android:name=".LFActivity"
>     >     android:label="@string/title_activity_lf"
>     >     android:theme="@style/AppTheme.NoActionBar" />
>     >              <activity android:name=".ContactUSActivity" />
>     >              <activity android:name=".Main4Activity" />
>     >              <activity
>     >     android:name=".Main5Activity"
>     >     android:label="@string/title_activity_main5"
>     >     android:theme="@style/AppTheme.NoActionBar"></activity>
>     >          </application>
>     >
>     >     </manifest>
>     >
>     >
>     >     thank u in advance
>     >
>     >     Regards
>     >
>     >     Elio HBEICH
>     >
>
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

Reply via email to