当前位置: 首页>>代码示例>>Java>>正文


Java URI.getLocalName方法代码示例

本文整理汇总了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;
		}
	};
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:26,代码来源:LabeledPairRenderer.java

示例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;
		}
	};
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:17,代码来源:LabeledPairRenderer.java

示例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;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:39,代码来源:RetrievingLabelCache.java

示例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;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:35,代码来源:NodeEdgeNumberedPropertyUtility.java

示例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 + ">";
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:14,代码来源:GraphToSparql.java

示例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();
		}
	};
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:9,代码来源:LabeledPairTreeCellRenderer.java

示例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;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:29,代码来源:ResourceTreeRenderer.java

示例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();
		}
	};
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:9,代码来源:LabeledPairTableCellRenderer.java

示例9: AbstractGraphElement

import org.openrdf.model.URI; //导入方法依赖的package包/类
public AbstractGraphElement( URI id ) {
	this( id, null, id.getLocalName() );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:4,代码来源:AbstractGraphElement.java

示例10: SEMOSSVertexImpl

import org.openrdf.model.URI; //导入方法依赖的package包/类
public SEMOSSVertexImpl( URI id ) {
	this( id, null, id.getLocalName() );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:4,代码来源:SEMOSSVertexImpl.java

示例11: SEMOSSEdgeImpl

import org.openrdf.model.URI; //导入方法依赖的package包/类
public SEMOSSEdgeImpl( URI _uri ) {
	super( _uri, null, _uri.getLocalName() );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:4,代码来源:SEMOSSEdgeImpl.java

示例12: QueryNode

import org.openrdf.model.URI; //导入方法依赖的package包/类
public QueryNode( URI id ) {
	this( id, null, id.getLocalName() );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:4,代码来源:QueryNode.java


注:本文中的org.openrdf.model.URI.getLocalName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。