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

Reply via email to