public Prologue(PrefixMapping pmap, String base) { this.prefixMap = pmap ; setBaseURI(base) ; }
public Prologue sub(PrefixMapping newMappings, String base) { // New prefix mappings PrefixMapping ext = getPrefixMapping() ; if ( newMappings != null ) ext = new PrefixMapping2(ext, newMappings) ; // New base. IRIResolver r = resolver ; if ( base != null ) r = new IRIResolver(base) ; return new Prologue(ext, r) ; }
/** Test whether a Prologue wil perform the same as this one. */ public boolean samePrologue(Prologue other) { // Prologue are mutable and superclasses so .equals is left as the default. String base1 = explicitlySetBaseURI() ? getBaseURI() : null ; String base2 = other.explicitlySetBaseURI() ? other.getBaseURI() : null ; if (! Lib.equal(base1, base2) ) return false ; if ( getPrefixMapping() == null && other.getPrefixMapping() == null ) return true ; if ( getPrefixMapping() == null ) return false ; return getPrefixMapping().samePrefixMappingAs(other.getPrefixMapping()) ; }
static public String stringForURI(String uri, Prologue prologue) { return stringForURI(uri, prologue.getBaseURI(), prologue.getPrefixMapping()) ; }
public SerializationContext(PrefixMapping prefixMap) { this(new Prologue(prefixMap)) ; }
final public void PrefixDecl() throws ParseException { Token t ; String iri ; jj_consume_token(PREFIX); t = jj_consume_token(PNAME_NS); iri = IRI_REF(); String s = fixupPrefix(t.image, t.beginLine, t.beginColumn) ; getPrologue().setPrefix(s, iri) ; }
p.setBaseURI( baseDecl43 ); p.setPrefix( (prefixDecl44!=null?prefixDecl44.prefix:null), (prefixDecl44!=null?prefixDecl44.expansion:null) );
/** * @return Returns the prefixMap. */ public PrefixMapping getPrefixMapping() { return prologue.getPrefixMapping(); }
private static void printBase(Prologue prologue, IndentedWriter out) { if ( prologue.getBaseURI() != null && prologue.explicitlySetBaseURI() ) { out.print("BASE ") ; out.print("<"+prologue.getBaseURI()+">") ; out.newline() ; } }
prologue = new Prologue(globalPrefixMap) ; m.setNsPrefixes(prologue.getPrefixMapping()) ; RDFWriter rdfw = m.getWriter("TURTLE") ; m.setNsPrefix("rs", ResultSetGraphVocab.getURI()) ;
public String getBaseIRI() { return prologue.getBaseURI() ; }
protected String resolvePName(String qname, int line, int column) { String s = getPrologue().expandPrefixedName(qname) ; if ( s == null ) throwParseException("Unresolved prefixed name: "+qname, line, column) ; return s ; }
/** Append update operations to a request */ protected static UpdateParser setupParser(Prologue prologue, String baseURI, Syntax syntax) { if ( syntax != syntaxSPARQL_11 && syntax != syntaxARQ ) throw new UnsupportedOperationException("Unrecognized syntax for parsing update: "+syntax) ; UpdateParser parser = UpdateParser.createParser(syntax) ; if ( parser == null ) throw new UnsupportedOperationException("Unrecognized syntax for parsing update: "+syntax) ; if ( prologue.getResolver() == null ) { // Sort out the baseURI - if that fails, dump in a dummy one and continue. try { baseURI = IRIResolver.chooseBaseURI(baseURI) ; } catch (Exception ex) { baseURI = "http://localhost/defaultBase#" ; } prologue.setResolver(new IRIResolver(baseURI)) ; } return parser ; }
private String resolveIRI(String iriStr, int line, int column) { if ( prologue.getResolver() != null ) return prologue.getResolver().resolve(iriStr) ; return iriStr ; }
public Prologue sub(PrefixMapping newMappings) { return sub(newMappings, null) ; } public Prologue sub(String base) { return sub(null, base) ; }
/** * @param prefixMap The prefixMap to set. */ public void setPrefixMapping(PrefixMapping prefixMap) { prologue.setPrefixMapping(prefixMap) ; }
public UpdateVisitorSink(UpdateVisitor worker) { this.prologue = new Prologue(); this.worker = worker; }
static public String stringForURI(String uri, Prologue prologue) { return stringForURI(uri, prologue.getBaseURI(), prologue.getPrefixMapping()) ; }
final public void PrefixDecl() throws ParseException { Token t ; String iri ; jj_consume_token(PREFIX); t = jj_consume_token(PNAME_NS); iri = IRIREF(); String s = fixupPrefix(t.image, t.beginLine, t.beginColumn) ; getPrologue().setPrefix(s, iri) ; }
/** * @return Returns the prefixMap. */ public PrefixMapping getPrefixMapping() { return prologue.getPrefixMapping(); }