本文整理汇总了Java中org.openrdf.model.URI.getLocalName方法的典型用法代码示例。如果您正苦于以下问题:Java URI.getLocalName方法的具体用法?Java URI.getLocalName怎么用?Java URI.getLocalName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.model.URI
的用法示例。
在下文中一共展示了URI.getLocalName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValuePairRenderer
import org.openrdf.model.URI; //导入方法依赖的package包/类
public static LabeledPairRenderer<Value> getValuePairRenderer( IEngine eng ) {
return new LabeledPairRenderer<Value>() {
@Override
protected String getLabelForCacheMiss( Value val ) {
if ( null == val ) {
return "";
}
String ret;
if ( val instanceof URI ) {
URI uri = URI.class.cast( val );
ret = ( null == eng ? uri.getLocalName()
: Utility.getInstanceLabel( Resource.class.cast( val ), eng ) );
cache( val, ret );
}
else if ( val instanceof Literal ) {
ret = Literal.class.cast( val ).getLabel();
}
else {
ret = val.stringValue();
}
return ret;
}
};
}
示例2: getUriPairRenderer
import org.openrdf.model.URI; //导入方法依赖的package包/类
public static LabeledPairRenderer<URI> getUriPairRenderer( IEngine eng ) {
return new LabeledPairRenderer<URI>() {
@Override
protected String getLabelForCacheMiss( URI val ) {
if ( null == val ) {
return "";
}
URI uri = URI.class.cast( val );
String ret = ( null == eng ? uri.getLocalName()
: Utility.getInstanceLabel( Resource.class.cast( val ), eng ) );
cache( val, ret );
return ret;
}
};
}
示例3: cache
import org.openrdf.model.URI; //导入方法依赖的package包/类
/**
* Caches a label for the given value. If the value is already cached, null is
* returned (NOT the cached value).
*
* @param value
* @return
*/
public String cache( Value value ) {
Value val = Value.class.cast( value );
String label = null;
if ( !super.containsKey( val ) ) {
if ( value instanceof URI ) {
URI uri = URI.class.cast( value );
if ( null == engine ) {
labelFromLocalName.add( uri );
label = uri.getLocalName();
}
else {
label = Utility.getInstanceLabel( uri, engine );
}
}
else if ( value instanceof Literal ) {
Literal lit = Literal.class.cast( value );
label = lit.getLabel();
}
else {
label = value.toString();
}
if ( caching ) {
put( Value.class.cast( value ), label );
}
}
return label;
}
示例4: transformProperties
import org.openrdf.model.URI; //导入方法依赖的package包/类
public static Map<String, Object> transformProperties(Map<URI, Object> oldProperties, boolean useKeepProperties) {
HashMap<String, Object> newProperties = new HashMap<>();
for( Map.Entry<URI, Object> propEntry : oldProperties.entrySet() ) {
URI propertyURI = propEntry.getKey();
String propertyName = propertyURI.getLocalName();
if (displayNameMap.keySet().contains(propertyURI))
propertyName = displayNameMap.get(propertyURI);
if (displayNameMap.keySet().contains(propertyName))
propertyName = displayNameMap.get(propertyName);
if (useKeepProperties && keepPropertySet.contains(propertyName)) {
String valueAsString = propEntry.getValue() + "";
if (propEntry.getValue() instanceof URI)
valueAsString = ((URI) propEntry.getValue()).getLocalName();
newProperties.put( propertyName, valueAsString );
localNameToURIHash.put( propertyName, propEntry.getKey() );
continue;
}
if (hidePropertySet.contains(propertyName))
continue;
Double valueAsDouble = getDoubleIfPossibleFrom( propEntry.getValue() );
if (valueAsDouble <= 0)
continue;
newProperties.put( propertyName, valueAsDouble );
localNameToURIHash.put( propertyName, propEntry.getKey() );
}
return newProperties;
}
示例5: shortcut
import org.openrdf.model.URI; //导入方法依赖的package包/类
private String shortcut( URI type ) {
if ( null == type ) {
return null;
}
for ( Map.Entry<String, String> ns : namespaces.entrySet() ) {
if ( type.getNamespace().equals( ns.getValue() ) ) {
return ns.getKey() + ":" + type.getLocalName();
}
}
return "<" + type + ">";
}
示例6: getUriPairRenderer
import org.openrdf.model.URI; //导入方法依赖的package包/类
public static LabeledPairTreeCellRenderer<URI> getUriPairRenderer() {
return new LabeledPairTreeCellRenderer<URI>() {
@Override
protected String getLabelForCacheMiss( URI val ) {
return val.getLocalName();
}
};
}
示例7: getTreeCellRendererComponent
import org.openrdf.model.URI; //导入方法依赖的package包/类
@Override
public Component getTreeCellRendererComponent( JTree tree, Object value,
boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus ) {
DefaultMutableTreeNode dmtNode = DefaultMutableTreeNode.class.cast( value );
Object o = dmtNode.getUserObject();
if ( null == o || !( o instanceof URI ) ) {
return super.getTreeCellRendererComponent( tree, o, selected, expanded,
leaf, row, hasFocus );
}
URI uri = URI.class.cast( dmtNode.getUserObject() );
String text = ( useLabels && null != rlc
? rlc.get( uri )
: uri.getLocalName() );
super.getTreeCellRendererComponent( tree, text, selected, expanded,
leaf, row, hasFocus );
if ( !dmtNode.isLeaf() ) {
NamedShape shape = shapefactory.getShape( uri );
setIcon( new IconBuilder( shape ).setStroke( Color.BLACK )
.setPadding( 2 ).setIconSize( 18 ).build() );
}
return this;
}
示例8: getUriPairRenderer
import org.openrdf.model.URI; //导入方法依赖的package包/类
public static LabeledPairTableCellRenderer<URI> getUriPairRenderer() {
return new LabeledPairTableCellRenderer<URI>() {
@Override
protected String getLabelForCacheMiss( URI val ) {
return val.getLocalName();
}
};
}
示例9: AbstractGraphElement
import org.openrdf.model.URI; //导入方法依赖的package包/类
public AbstractGraphElement( URI id ) {
this( id, null, id.getLocalName() );
}
示例10: SEMOSSVertexImpl
import org.openrdf.model.URI; //导入方法依赖的package包/类
public SEMOSSVertexImpl( URI id ) {
this( id, null, id.getLocalName() );
}
示例11: SEMOSSEdgeImpl
import org.openrdf.model.URI; //导入方法依赖的package包/类
public SEMOSSEdgeImpl( URI _uri ) {
super( _uri, null, _uri.getLocalName() );
}
示例12: QueryNode
import org.openrdf.model.URI; //导入方法依赖的package包/类
public QueryNode( URI id ) {
this( id, null, id.getLocalName() );
}