本文整理汇总了Java中com.obidea.semantika.util.StringUtils类的典型用法代码示例。如果您正苦于以下问题:Java StringUtils类的具体用法?Java StringUtils怎么用?Java StringUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringUtils类属于com.obidea.semantika.util包,在下文中一共展示了StringUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createValue
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
private Value createValue(IValue value)
{
if (value == null) {
return null;
}
if (value instanceof ILiteral) {
ILiteral literal = (ILiteral) value;
String label = literal.stringValue();
String lang = literal.getLanguage();
if (!StringUtils.isEmpty(lang)) {
return mValueFactory.createLiteral(label, lang);
}
else {
String datatype = literal.getDatatype();
return mValueFactory.createLiteral(label, mValueFactory.createURI(datatype));
}
}
else if (value instanceof IUri) {
IUri uri = (IUri) value;
return mValueFactory.createURI(uri.stringValue());
}
return null;
}
示例2: printOutput
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public void printOutput(PrintStream out, Object output)
{
if (output instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<String, String> map = (Map<String, String>) output;
for (String key : map.keySet()) {
String prefix = key;
if (StringUtils.isEmpty(prefix)) {
prefix = "(default)"; //
}
out.println(prefix + " = " + map.get(key));
}
}
out.println();
}
示例3: getNameFragments
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public String[] getNameFragments()
{
if (mNameFragments == null) {
List<String> fragments = new ArrayList<String>();
if (!StringUtils.isEmpty(mViewName)) {
fragments.add(mViewName);
fragments.add(getColumnName());
}
else {
if (!StringUtils.isEmpty(mSchemaName)) {
fragments.add(mSchemaName);
}
if (!StringUtils.isEmpty(mTableName)) {
fragments.add(mTableName);
}
fragments.add(getColumnName());
}
mNameFragments = CollectionUtils.toArray(fragments, String.class);
}
return mNameFragments;
}
示例4: getLiteralTerm
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
protected ITerm getLiteralTerm(String value, String termType, String datatype) throws MappingParserException
{
if (termType.equals(R2RmlVocabulary.IRI.getUri())) {
if (!StringUtils.isEmpty(datatype)) {
throw illegalTermalMappingException("Cannot use rr:datatype together with term type rr:IRI"); //$NON-NLS-1$
}
return getExpressionObjectFactory().getUriReference(getUri(value));
}
else if (termType.equals(R2RmlVocabulary.LITERAL.getUri())) {
return (StringUtils.isEmpty(datatype)) ?
getExpressionObjectFactory().getLiteral(value, DataType.STRING) : // by default
getExpressionObjectFactory().getLiteral(value, datatype);
}
else if (termType.equals(R2RmlVocabulary.BLANK_NODE.getUri())) {
throw unsupportedTermTypeException("rr:BlankNode"); //$NON-NLS-1$
}
throw unknownTermTypeException(termType);
}
示例5: getTemplateTerm
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
protected ITerm getTemplateTerm(String value, String termType, String datatype) throws MappingParserException
{
if (termType.equals(R2RmlVocabulary.IRI.getUri())) {
if (!StringUtils.isEmpty(datatype)) {
throw illegalTermalMappingException("Cannot use rr:datatype together with term type rr:IRI"); //$NON-NLS-1$
}
return getUriTemplateFunction(value);
}
else if (termType.equals(R2RmlVocabulary.LITERAL.getUri())) {
throw illegalTermalMappingException("Cannot use rr:template together with term type rr:Literal");
}
else if (termType.equals(R2RmlVocabulary.BLANK_NODE.getUri())) {
throw unsupportedTermTypeException("rr:BlankNode"); //$NON-NLS-1$
}
throw unknownTermTypeException(termType);
}
示例6: constructDatabaseObjectNamespace
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
/**
* Constructs namespace string for a database object, given the name components.
* Each name component is separated by a period.
*
* @param names
* the name components for constructing the namespace.
* @return namespace string.
*/
public static String constructDatabaseObjectNamespace(final String... names)
{
StringBuilder sb = new StringBuilder();
boolean needSeparator = false;
for (String name : names) {
if (StringUtils.isEmpty(name)) {
continue;
}
if (needSeparator) {
sb.append(DBO_SEPARATOR);
}
sb.append(name);
needSeparator = true;
}
return sb.toString();
}
示例7: toString
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder(getName());
sb.append("("); // $NON-NLS-1$
boolean needComma = false;
for (ITerm t : getParameters()) {
if (needComma) {
sb.append(", "); //$NON-NLS-1$
}
sb.append(t);
needComma = true;
}
sb.append(")"); // $NON-NLS-1$
if (isTyped()) {
String type = getDatatype().substring(getDatatype().indexOf("#") + 1); // $NON-NLS-1$
sb.append(":").append(StringUtils.toUpperCase(type)); //$NON-NLS-1$
}
return sb.toString();
}
示例8: validate
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public void validate() throws RepositoryConfigException
{
if (StringUtils.isEmpty(mConfigurationPath)) {
throw new RepositoryConfigException("Configuration path is empty"); //$NON-NLS-1$
}
}
示例9: export
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public Resource export(Graph graph)
{
Resource implNode = super.export(graph);
if (!StringUtils.isEmpty(mConfigurationPath)) {
graph.add(implNode, SEMANTIKA_CONFIG_PATH, sValueFactory.createLiteral(mConfigurationPath));
}
return implNode;
}
示例10: execute
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public IUriReference execute(List<? extends IConstant> arguments)
{
String toReturn = mTemplateString;
for (int i = 0; i < arguments.size(); i++) {
String value = arguments.get(i).getLexicalValue();
String str = StringUtils.useUnderscore(value);
toReturn = toReturn.replace(holder(i+1), str);
}
return TermUtils.makeUriReference(toReturn);
}
示例11: toString
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("UQ"); //$NON-NLS-1$
sb.append("("); //$NON-NLS-1$
sb.append("..."); //$NON-NLS-1$
sb.append(")"); //$NON-NLS-1$
if (!StringUtils.isEmpty(getViewName())) {
sb.append("["); //$NON-NLS-1$
sb.append(getViewName());
sb.append("]"); //$NON-NLS-1$
}
return sb.toString();
}
示例12: setViewName
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public void setViewName(String viewName)
{
if (!StringUtils.isEmpty(viewName)) {
mViewName = viewName;
mNameFragments = null; // notify to update name fragments
notifyVariableNameChanged(createName(getNameFragments()));
}
}
示例13: getNameFragments
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public String[] getNameFragments()
{
if (mNameFragments == null) {
List<String> fragments = new ArrayList<String>();
if (!StringUtils.isEmpty(mSchemaName)) {
fragments.add(mSchemaName);
}
fragments.add(getTableName());
mNameFragments = CollectionUtils.toArray(fragments, String.class);
}
return mNameFragments;
}
示例14: setAliasName
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public void setAliasName(String alias)
{
if (!StringUtils.isEmpty(alias)) {
mAliasName = alias;
}
}
示例15: characters
import com.obidea.semantika.util.StringUtils; //导入依赖的package包/类
@Override
public void characters(char[] ch, int start, int length) throws MappingParserException
{
/*
* Construct the SQL string from CDATA section. The string concatenation is
* necessary because SAX parser may present the text in CDATA in several chunks
* of strings by calling this method more than once.
*/
String buffer = new String(ch, start, length);
buffer = (StringUtils.isEmpty(buffer)) ? "" : buffer.replaceAll("\\s+", " "); //$NON-NLS-1$
mSqlString += buffer;
}