use of org.apache.jena.sparql.util.Symbol in project jena by apache.
the class EnvTDB method processProperties.
public static Context processProperties(Properties properties) {
Context context = new Context();
Set<Object> keys = properties.keySet();
for (Object key : keys) {
if (key instanceof String) {
String keyStr = (String) key;
if (keyStr.startsWith(prefix))
keyStr = SystemTDB.symbolNamespace + keyStr.substring(prefix.length());
if (!keyStr.startsWith(SystemTDB.symbolNamespace))
continue;
Object value = properties.get(key);
Symbol symbol = Symbol.create(keyStr);
context.set(symbol, value);
}
}
return context;
}
use of org.apache.jena.sparql.util.Symbol in project jena by apache.
the class RDFWriterRIOT method setProperty.
@Override
public Object setProperty(String propName, Object propValue) {
Symbol sym = Symbol.create(basename + "#" + propName);
Object oldObj = context.get(sym);
context.set(sym, propValue);
properties.put(propName, propValue);
// These are added to any Jena RDFWriter (old-style, e.g. RDF/XML) in
return oldObj;
}
use of org.apache.jena.sparql.util.Symbol in project jena by apache.
the class ContextMBean method getMBeanInfo.
@Override
public MBeanInfo getMBeanInfo() {
/*
* MBeanAttributeInfo(String name, String type, String description, boolean isReadable, boolean isWritable, boolean isIs)
*/
MBeanAttributeInfo[] attrInfo = new MBeanAttributeInfo[context.size()];
int idx = 0;
for (Symbol sk : context.keys()) {
// Not all are settable - only is string, boolean, integer.
Object obj = context.get(sk);
boolean settable = false;
if (obj instanceof String)
settable = true;
if (obj instanceof Boolean)
settable = true;
if (obj instanceof Integer)
settable = true;
MBeanAttributeInfo attr = new MBeanAttributeInfo(sk.getSymbol(), "java.lang.String", sk.getSymbol(), true, settable, false);
attrInfo[idx++] = attr;
}
/*
* String className,
String description,
MBeanAttributeInfo[] attributes,
MBeanConstructorInfo[] constructors,
MBeanOperationInfo[] operations,
MBeanNotificationInfo[] notifications)
throws IllegalArgumentException
*/
MBeanInfo info = new MBeanInfo(this.getClass().getName(), "ARQ global context", attrInfo, // Constructors
null, // Operations
null, // Notifications
null);
return info;
}