本文整理汇总了Java中com.hp.hpl.jena.shared.JenaException类的典型用法代码示例。如果您正苦于以下问题:Java JenaException类的具体用法?Java JenaException怎么用?Java JenaException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JenaException类属于com.hp.hpl.jena.shared包,在下文中一共展示了JenaException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serve
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
public void serve() {
// Error handling is still quite a mess here.
try {
doResponseModel();
} catch (IOException ioEx) {
throw new RuntimeException(ioEx);
} catch (JenaException jEx) {
try {
response.sendError(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"JenaException: " + jEx.getMessage());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
示例2: importInto
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
@Override
public void importInto(TopicMapIF topicmap) throws IOException {
try {
if (inputStream != null) {
RDFToTopicMapConverter.convert(inputStream, syntax, mappingurl == null ? null : mappingurl.toString(),
mappingsyntax, topicmap, lenient);
} else {
RDFToTopicMapConverter.convert(infileurl, syntax, mappingurl == null ? null : mappingurl.toString(),
mappingsyntax, topicmap, lenient);
}
if (generate_names)
RDFToTopicMapConverter.generateNames(topicmap);
} catch (JenaException e) {
throw new OntopiaRuntimeException(e);
}
if (duplicate_suppression)
DuplicateSuppressionUtils.removeDuplicates(topicmap);
}
示例3: getScope
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
/**
* Finds all RTM_IN_SCOPE properties for this property and returns a
* collection containing the RDF URIs of the values as URILocators.
*/
private Collection getScope(RDFNode rdfprop, Model model)
throws JenaException, MalformedURLException {
Resource subject = (Resource) rdfprop;
Property prop = model.getProperty(RTM_IN_SCOPE);
NodeIterator it = model.listObjectsOfProperty(subject, prop);
ArrayList scope = new ArrayList();
while (it.hasNext()) {
Object o = it.next();
if (!(o instanceof Resource))
throw new RDFMappingException("Scoping topic must be specified by a resource, not by " + o);
Resource obj = (Resource) o;
LocatorIF loc = new URILocator(obj.getURI());
scope.add(loc);
}
return scope;
}
示例4: getType
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
private TopicIF getType(RDFNode rdfprop, Model model)
throws JenaException, MalformedURLException {
Resource subject = (Resource) rdfprop;
Property prop = model.getProperty(RTM_TYPE);
NodeIterator it = model.listObjectsOfProperty(subject, prop);
while (it.hasNext()) {
Resource obj = (Resource) it.next();
LocatorIF loc = new URILocator(obj.getURI());
TopicIF topic = topicmap.getTopicBySubjectIdentifier(loc);
if (topic == null) {
topic = builder.makeTopic();
topic.addSubjectIdentifier(loc);
}
return topic;
}
return null;
}
示例5: compileTriplePattern
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
private ConstraintExpression compileTriplePattern(ConstraintExpression c,
Map<Node,Variable> vars_jm,
Node s, Node p, Node o) {
try {
ConstraintElement sElt = compile(vars_jm, s);
ConstraintElement pElt = compile(vars_jm, p);
ConstraintElement oElt = compile(vars_jm, o);
ConstraintExpression c2 = new ConstraintImpl(sElt, pElt, oElt);
if (c != null) return new org.mulgara.query.ConstraintConjunction(c, c2);
else return c2;
} catch (Exception ex) {
throw new JenaException("Failed to compile: ("+s+" "+p+" "+o+")");
}
}
示例6: rdfListIterator
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
protected Iterator<RDFNode> rdfListIterator(Resource r)
{
List<RDFNode> list = new ArrayList<RDFNode>() ;
for ( ; ! r.equals(RDF.nil); )
{
StmtIterator sIter = r.getModel().listStatements(r, RDF.first, (RDFNode)null) ;
list.add(sIter.nextStatement().getObject()) ;
if ( sIter.hasNext() )
// @@ need to cope with this (unusual) case
throw new JenaException("N3: Multi valued list item") ;
sIter = r.getModel().listStatements(r, RDF.rest, (RDFNode)null) ;
r = (Resource)sIter.nextStatement().getObject() ;
if ( sIter.hasNext() )
throw new JenaException("N3: List has two tails") ;
}
return list.iterator() ;
}
示例7: setArgs
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
protected void setArgs( Domain args, PreparedStatement ps )
{
try
{
for (int i = 0; i < compiled.argCnt; i++)
{
int ix = (compiled.argIndex.get( i )).intValue();
Node arg = args.get( ix );
if (arg == null) throw new JenaException( "Null query argument" );
String val = compiled.driver.nodeToRDBString( arg, false );
ps.setString( i + 1, val );
}
}
catch (SQLException e)
{ throw new JenaException( "Bad query argument", e ); }
}
示例8: put
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
public void put(K id, T val) {
synchronized (this) {
int curSize = keyCache.size();
keyCache.put(id, val);
valCache.put(val,id);
if (keyCache.size() > curSize) {
int ix = count++;
if (count > maxCount) {
// pick an entry at random and remove it.
// not exactly LRU
ix = rand.nextInt(maxCount);
Object keyval = keyCache.get(Keys[ix]);
if ( (keyval == null) || (keyCache.remove(Keys[ix]) == null) )
throw new JenaException("LRUCache keyCache corrupted");
if ( valCache.remove(keyval) == null )
throw new JenaException("LRUCache valCache corrupted");
count--;
Keys[ix] = id;
if (keyCache.size() > maxCount)
throw new JenaException("LRUCache exceeds threshold");
}
Keys[ix] = id;
}
}
}
示例9: DBQuery
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
/**
to compile an array of triples, compile each triple and form the corresponding
array of Patterns. *preserve the order*.
*/
public static DBQuery compile
( DBQueryStageCompiler compiler, DBQueryHandler qh, SpecializedGraph sg,
List<VarDesc> varList, List<DBPattern> dbPat, ExpressionSet constraints )
{
DBQuery query = new DBQuery( sg,varList,qh.queryOnlyStmt, qh.queryOnlyReif,qh.queryFullReif );
if ( qh.getQueryOnlyReified() && !qh.getQueryFullReified() )
throw new JenaException("Fastpath currently requires QueryFullReified to be true if QueryOnlyReified is also true");
if (!query.isEmpty)
{
for (int i = 0; i < dbPat.size(); i += 1) compilePattern ( compiler, query, dbPat.get(i) );
compileConstraints( compiler, query, constraints );
compileQuery( compiler, query );
}
if (logger.isDebugEnabled()) logger.debug( "generated SQL: " + query.stmt );
return query;
}
示例10: getSQLStatement
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
/**
* Return the raw SQL statement corresponding to the named operation.
* Substitute the ${a} attribute macro for the current attribute number.
*/
public String getSQLStatement(String opname, String[] attr) throws SQLException {
String cmd = m_sql.getProperty(opname);
if (cmd == null) {
if ( opname.startsWith("*") ) {
cmd = genSQLStatement(opname);
m_sql.setProperty(opname, cmd);
} else {
logger.error("Unable to find SQL for operation: " + opname);
throw new SQLException("Unable to find SQL for operation: " + opname);
}
}
int attrCnt = (attr == null) ? 0 : attr.length;
if ( attrCnt > 0 ) cmd = substitute(cmd, "${a}", attr[0]);
if ( attrCnt > 1 ) cmd = substitute(cmd, "${b}", attr[1]);
if ( attrCnt > 2 ) cmd = substitute(cmd, "${c}", attr[2]);
if ( attrCnt > 3 ) throw new JenaException("Too many arguments");
return cmd;
}
示例11: genSQLStatement
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
/**
* Return dynamically generated SQL for the specified operation.
* @param opname the command to generate; must start with "*", the opname and then op params.
* @return the generated command as a String.
*/
protected String genSQLStatement ( String opname ) throws SQLException {
/* for testing. for now, we only generate one operation, findReif,
* to find reified statements from a triple match pattern.
*/
String sql = "";
boolean badop = false;
if ( opname.startsWith("*") ) {
// a space separate the operation name from its parameters.
int delim = opname.indexOf(' ');
String op = opname.substring(1,delim);
String args = opname.substring(delim+1);
if ( op.equals("findReif") ) {
sql = genSQLStmtFindReif(op,args);
} else badop = true;
} else badop = true;
if ( badop ) {
logger.error("Unable to generate SQL for operation: " + opname);
throw new JenaException("Unable to generate SQL for operation: " + opname);
}
return sql;
}
示例12: chooseClassLoader
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
static public ClassLoader chooseClassLoader()
{
ClassLoader classLoader = Thread.currentThread().getContextClassLoader() ;
if ( classLoader != null )
log.trace ( "Using thread classloader" ) ;
if ( classLoader == null )
{
classLoader = ClassLoader.getSystemClassLoader() ;
if ( classLoader != null )
log.trace ( "Using system classloader" ) ;
}
if ( classLoader == null )
throw new JenaException ( "Failed to find a classloader" ) ;
return classLoader ;
}
示例13: connectToDB
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
/**
* Connect to a database.
* @param urlStr
* @param dbUser
* @param dbPassword
* @param dbType
* @param driverName Load this driver (if not null)
* @return Model
*/
public static Model connectToDB(String urlStr,
String dbUser, String dbPassword,
String modelName,
String dbType, String driverName)
{
// Fragment ID is the model name.
try {
if ( driverName != null )
Class.forName(driverName).newInstance();
} catch (Exception ex) {}
try {
IDBConnection conn =
ModelFactory.createSimpleRDBConnection(urlStr, dbUser, dbPassword, dbType) ;
return ModelRDB.open(conn, modelName) ;
} catch (JenaException rdfEx)
{
LoggerFactory.getLogger(ModelLoader.class).error("Failed to open SQL database: ModelLoader.connectToDB", rdfEx) ;
throw rdfEx ;
}
}
示例14: serve
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
public void serve() {
// Error hendling is still quite a mess here.
try {
doResponseModel();
} catch (IOException ioEx) {
throw new RuntimeException(ioEx);
} catch (JenaException jEx) {
try {
response.sendError(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"JenaException: " + jEx.getMessage());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:17,代码来源:ModelResponse.java
示例15: parse
import com.hp.hpl.jena.shared.JenaException; //导入依赖的package包/类
public Model parse() {
try {
return CompatibilityFileManager.loadModel(file);
} catch (JenaException ex) {
Throwable cause = ex.getCause();
if (cause instanceof RiotException) {
report.report(Problem.SYNTAX_ERROR, cause.getMessage(), cause);
} else {
report.report(Problem.IO_ERROR, ex.getMessage(), ex);
}
return null;
}
}