title: How to make a connection with my ontology?
body: <p>I created an ontology with Protégé. Then I created an Android interface which contains two edit texts and a button. The main function of my code is to make a connection between my application and the ontology and store these data into it. I use a triple store for storage. </p>
  
  <p>But it didn't work correctly. I'm using Sesame as server but I don't know how to get the correct URL of the "update" service. I might have made other errors but here is my activity's code:</p>
  
  <pre><code>package com.example.ontologie1;
  import com.hp.hpl.jena.ontology.DatatypeProperty;
  import com.hp.hpl.jena.ontology.Individual;
  import com.hp.hpl.jena.ontology.OntClass;
  import com.hp.hpl.jena.ontology.OntModel;
  import com.hp.hpl.jena.ontology.OntModelSpec;
  import com.hp.hpl.jena.rdf.model.Literal;
  import com.hp.hpl.jena.rdf.model.ModelFactory;
  import com.hp.hpl.jena.rdf.model.Property;
  import java.io.BufferedInputStream;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.InputStream;
  import android.os.Bundle;
  import android.app.Activity;
  import android.content.Intent;
  import java.io.IOException;
  
  import org.apache.commons.httpclient.NameValuePair;
  import org.apache.commons.httpclient.methods.PostMethod;
  
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  public class MainActivity extends Activity {
    private Button buttonconnexion;
    private EditText editpseudo;
    private EditText editpassword;
    public String ps;
    public String pa;
  
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      editpseudo = (EditText) findViewById(R.id.welcomeedittextlogin);
      editpassword = (EditText) findViewById(R.id.welcomeedittextpassword);
      buttonconnexion = (Button) findViewById(R.id.welcomebuttonconnexion);
      buttonconnexion.setOnClickListener(click1);
    }
  
    protected OnClickListener click1 = new OnClickListener() {
      public void onClick(View arg0) {
        ps= editpseudo.getText().toString();
        pa= editpassword.getText().toString();
        try {
          connexion(ps , pa);
        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
    };
  
    protected void connexion(String pseudo,String password) throws IOException {
  
      String requete = "&lt;http://www.w3.org/2002/07/owl#&gt; .\n"
          + "INSERT DATA {\n"
          + "    &lt;http://www.owl-ontologies.com/Ontology_profile.owl#USER&gt;   a   onto:USER;\n"
          + "        onto:Login  " + pseudo + ";\n"
          + "        onto:Password  " + password + ";\n"
          + "}";
  
  
      PostMethod post = new PostMethod("&lt;http://www.openrdf.org/config/repository#&gt;");
      NameValuePair[] paramRequete = {
          new NameValuePair("query", requete),
      };
      post.setRequestBody(paramRequete);
  
      InputStream in = post.getResponseBodyAsStream();
      Toast t = null ;
      t.setText(in.toString());
      t=new Toast(null);
    }
  }
  </code></pre>