SPARQL query modification with ARQ API

Hi All,

I have the following question on working with ARQ API:

If I have an object of com.hp.hpl.jena.sparql.syntax.Element class, containing four triple pattren as follows;
{ ?artical   <http://swrc.ontoware.org/ontology#author>  ?person .
  ?person  <http://data.semanticweb.org/ns/swc/ontology#affiliation>  ?org ;
           <http://www.w3.org/2000/01/rdf-schema#label>  ?name .
  ?artical   <http://purl.org/dc/elements/1.1/title>  ?title .
}

code displays above graph pattren:
System.out.println(element); // where element is an object of Element class.

I have the following questions. Please write a small piece of code.
Question 1: How can I replace 2nd triple with 
?person  <http://data.semanticweb.org/ns/swc/ontology#worksIn>  ?org

Question 2: How can I remove 3rd triple pattren?


Question 3: If I have algebra expression as given below (in an object of class com.hp.hpl.jena.sparql.algebra.Op), how can I add and remove a triple pattren in this algebra expression? Please mention a short code.
(project (?name ?org ?title)
  (order (?org)(BGP
      (triple ?artical <http://swrc.ontoware.org/ontology#author> ?writer)
      (triple ?writer <http://data.semanticweb.org/ns/swc/ontology#affiliation> ?org)
      (triple ?writer <http://www.w3.org/2000/01/rdf-schema#label> ?name)
      (triple ?artical <http://purl.org/dc/elements/1.1/title> ?title)
    )))

Thanks in advance,

--
Ahmad Ali Iqbal
Visiting Scholar (Februry 15 to July 22, 2008)
Semantic Information Systems and Language Engineering Group
Digital Enterprise Research Institute (DERI)
Galway, Ireland.
Email: ahmad.iqbal at deri.org
Tel: +353 8782 11402

Ph.D. Research Scholar
School of Electrical Engineering and Telecommunications
University of New South Wales (UNSW)
National ICT Australia Ltd
Bay 15, Locomotive Workshop, Australian Technology Park
Eveleigh, NSW 1430
Email: ahmad.iqbal at {student.unsw.edu.au, nicta.com.au}
Tel: +61 2 8374 5543, Fax: +61 2 8374 5531

Received on Friday, 9 May 2008 18:26:12 UTC