1 5 6 7 19 20 package com.hp.hpl.jena.joseki; 21 22 import org.apache.commons.logging.* ; 23 import com.hp.hpl.jena.rdf.model.* ; 24 25 public class QuerySPO extends HttpQuery 26 { 27 static Log logger = LogFactory.getLog(QuerySPO.class.getName()) ; 28 29 String subject = null ; 30 String predicate = null ; 31 String object = null ; 32 String value = null ; 33 boolean closure = false ; 34 35 39 40 public QuerySPO(String target) 41 { 42 super(target, "Triples") ; 43 } 44 45 53 54 public QuerySPO(String target, Resource r, Property p, Literal lit) 55 { 56 super(target, "Triples") ; 57 if ( r != null ) 58 setSubject(r.getURI()) ; 59 if ( p != null ) 60 setPredicate(p.getURI()) ; 61 if ( lit != null ) 62 setValue(lit.getLexicalForm()) ; 63 } 64 65 73 74 public QuerySPO(String target, Resource r, Property p, Resource obj) 75 { 76 super(target, "Triples") ; 77 if ( r != null ) 78 setSubject(r.getURI()) ; 79 if ( p != null ) 80 setPredicate(p.getURI()) ; 81 if ( obj != null ) 82 setObject(obj.getURI()) ; 83 } 84 85 public void setSubject(String subj) 86 { 87 subject = subj ; 88 super.addParam("s", subj) ; 89 } 90 91 public void setPredicate(String pred) 92 { 93 predicate = pred ; 94 super.addParam("p", pred) ; 95 } 96 97 public void setObject(String obj) 98 { 99 object = obj ; 100 super.addParam("o", obj) ; 101 } 102 103 public void setValue(String val) 104 { 105 value = val ; 106 super.addParam("v", val) ; 107 } 108 109 public void setClosure(boolean close) 110 { 111 closure = close ; 112 super.addParam("close", String.valueOf(close)) ; 113 } 114 } 115 116 117 143 | Popular Tags |