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


Java Value.stringValue方法代码示例

本文整理汇总了Java中org.openrdf.model.Value.stringValue方法的典型用法代码示例。如果您正苦于以下问题:Java Value.stringValue方法的具体用法?Java Value.stringValue怎么用?Java Value.stringValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openrdf.model.Value的用法示例。


在下文中一共展示了Value.stringValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildPropertyHTMLString

import org.openrdf.model.Value; //导入方法依赖的package包/类
private String buildPropertyHTMLString( List<URI> properties, GraphElement vertex ) {
	StringBuilder propertiesHTMLString = new StringBuilder();

	for ( URI prop : properties ) {
		if ( vertex.hasProperty( prop ) ) {
			Value val = vertex.getValue( prop );

			if ( 0 != propertiesHTMLString.length() ) {
				propertiesHTMLString.append( "<br>" );
			}

			if ( displayLabelFor( prop ) ) {
				propertiesHTMLString.append( getLabel( prop ) ).append( ": " );
			}

			String str = ( RDF.TYPE.equals( prop )
					? getLabel( URI.class.cast( val ) ) : val.stringValue() );

			propertiesHTMLString.append( str );
		}
	}

	return propertiesHTMLString.toString();
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:25,代码来源:TooltipTransformer.java

示例2: getValuePairRenderer

import org.openrdf.model.Value; //导入方法依赖的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

示例3: ConstVar

import org.openrdf.model.Value; //导入方法依赖的package包/类
public ConstVar(Value value) {
	if (value == null) {
		throw new IllegalArgumentException("value can not be null");
	}

	String uniqueStringForValue = value.stringValue();

	if (value instanceof Literal) {
		uniqueStringForValue += "-lit";

		// we need to append datatype and/or language tag to ensure a unique var name (see SES-1927)
		Literal lit = (Literal) value;
		if (lit.getDatatype() != null) {
			uniqueStringForValue += "-" + lit.getDatatype().stringValue();
		}
		if (lit.getLanguage() != null) {
			uniqueStringForValue += "-" + lit.getLanguage();
		}
	} else if (value instanceof BNode) {
		uniqueStringForValue += "-node";
	} else {
		uniqueStringForValue += "-uri";
	}
	setName("-const-" + uniqueStringForValue);
	setConstant(true);
	setAnonymous(true);
	setValue(value);
}
 
开发者ID:lszeremeta,项目名称:neo4j-sparql-extension-yars,代码行数:29,代码来源:ConstVar.java

示例4: getURI

import org.openrdf.model.Value; //导入方法依赖的package包/类
/**
 * @param value The value containing the URI.
 * @return The URI contained in the variable.
 * @throws NoURIException If no URI could be found.
 */
private String getURI(Value value) throws NoURIException
{
  if (value == null) {
    throw new NoURIException();
  }
  if (!(value instanceof URIImpl)) {
    throw new NoURIException();
  }
  return value.stringValue();
}
 
开发者ID:Wikidata,项目名称:QueryAnalysis,代码行数:16,代码来源:OpenRDFQueryHandler.java

示例5: sparql

import org.openrdf.model.Value; //导入方法依赖的package包/类
private String sparql(final Value val) {
    if (val instanceof Literal) {
        return val.toString();
    } else if (val instanceof URI) {
        return '<' + val.stringValue() + '>';
    } else {
        throw new IllegalArgumentException();
    }
}
 
开发者ID:blazegraph,项目名称:tinkerpop3,代码行数:10,代码来源:SparqlGenerator.java

示例6: getStringList

import org.openrdf.model.Value; //导入方法依赖的package包/类
public static OneVarListQueryAdapter<String> getStringList( String sparql, String var ) {
	return new OneVarListQueryAdapter<String>( sparql, var ) {

		@Override
		protected String getValue( Value value, ValueFactory fac ) {
			return value.stringValue();
		}
	};
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:10,代码来源:OneVarListQueryAdapter.java

示例7: forStrings

import org.openrdf.model.Value; //导入方法依赖的package包/类
public static ListOfMapsQueryAdapter<String> forStrings( String sparql ) {
  ListOfMapsQueryAdapter<String> q = new ListOfMapsQueryAdapter<String>( sparql ) {

    @Override
    protected String convertValue( String variable, Value v, ValueFactory fac ) {
      return v.stringValue();
    }
  };

  return q;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:12,代码来源:ListOfMapsQueryAdapter.java

示例8: getString

import org.openrdf.model.Value; //导入方法依赖的package包/类
public static OneValueQueryAdapter<String> getString( String sparql, String var ) {
	return new OneValueQueryAdapter<String>( sparql, var ) {

		@Override
		protected String getValue( Value value, ValueFactory fac ) {
			return value.stringValue();
		}
	};
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:10,代码来源:OneValueQueryAdapter.java

示例9: addNode

import org.openrdf.model.Value; //导入方法依赖的package包/类
@Override
public URI addNode( LoadingNodeAndPropertyValues nap, Map<String, String> namespaces,
		LoadingSheetData sheet, ImportMetadata metas, RepositoryConnection myrc ) throws RepositoryException {

	String typename = nap.getSubjectType();
	String rawlabel = nap.getSubject();
	URI subject = addSimpleNode( typename, rawlabel, namespaces, metas, myrc );

	ValueFactory vf = myrc.getValueFactory();
	boolean savelabel = metas.isAutocreateMetamodel();
	if ( !metas.isLegacyMode() && rawlabel.contains( ":" ) ) {
		// we have something with a colon in it, so we need to figure out if it's
		// a namespace-prefixed string, or just a string with a colon in it

		Value val = getRDFStringValue( rawlabel, namespaces, vf );
		// check if we have a prefixed URI
		URI u = getUriFromRawString( rawlabel, namespaces );
		savelabel = ( savelabel && null == u );
		rawlabel = val.stringValue();
	}

	// if we have a label property, skip this label-making
	// (it'll get handled in the addProperties function later)
	if ( savelabel && !nap.hasProperty( RDFS.LABEL, namespaces ) ) {
		myrc.add( subject, RDFS.LABEL, vf.createLiteral( rawlabel ) );
	}

	addProperties( subject, nap, namespaces, sheet, metas, myrc );

	return subject;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:32,代码来源:LegacyEdgeModeler.java

示例10: addNode

import org.openrdf.model.Value; //导入方法依赖的package包/类
@Override
public URI addNode( LoadingSheetData.LoadingNodeAndPropertyValues nap,
		Map<String, String> namespaces, LoadingSheetData sheet, ImportMetadata metas,
		RepositoryConnection myrc ) throws RepositoryException {

	String typename = nap.getSubjectType();
	String rawlabel = nap.getSubject();

	URI subject = addSimpleNode( typename, rawlabel, namespaces, metas, myrc, true );

	ValueFactory vf = myrc.getValueFactory();
	boolean savelabel = metas.isAutocreateMetamodel();
	if ( rawlabel.contains( ":" ) ) {
		// we have something with a colon in it, so we need to figure out if it's
		// a namespace-prefixed string, or just a string with a colon in it

		Value val = getRDFStringValue( rawlabel, namespaces, vf );
		// check if we have a prefixed URI
		URI u = getUriFromRawString( rawlabel, namespaces );
		savelabel = ( savelabel && null == u );
		rawlabel = val.stringValue();
	}

	// if we have a label property, skip this label-making
	// (it'll get handled in the addProperties function later)
	if ( savelabel && !nap.hasProperty( RDFS.LABEL, namespaces ) ) {
		myrc.add( subject, RDFS.LABEL, vf.createLiteral( rawlabel ) );
	}

	addProperties( subject, nap, namespaces, sheet, metas, myrc );

	return subject;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:34,代码来源:AbstractEdgeModeler.java

示例11: testGetValueFromObject

import org.openrdf.model.Value; //导入方法依赖的package包/类
@Test
public void testGetValueFromObject() {
	Integer integer = 3;
	Value val = RDFDatatypeTools.getValueFromObject( integer );
	String s = val.stringValue();
	assertEquals( "3", s );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:8,代码来源:RDFDatatypeToolsTest.java

示例12: testGetRDFStringValue

import org.openrdf.model.Value; //导入方法依赖的package包/类
@Test
public void testGetRDFStringValue() {
	ValueFactory vf = new ValueFactoryImpl();
	Map<String, String> map = new HashMap<>();
	map.put( "rdf", "http://www.w3.org/2001/" );
	Value val = RDFDatatypeTools.getRDFStringValue( "3200", map, vf );
	String stringVal = val.stringValue();
	assertEquals( stringVal, "3200" );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:10,代码来源:RDFDatatypeToolsTest.java

示例13: getText

import org.openrdf.model.Value; //导入方法依赖的package包/类
/**
 * Method transform. Transforms the label on a node vertex in the graph
 *
 * @param vertex DBCMVertex - the vertex to be transformed
 *
 * @return String - the property name of the vertex
 */
public String getText( T vertex ) {
	List<URI> propertiesList = getDisplayableProperties( vertex.getType() );

	//uri required for uniqueness, need these font tags so that when you increase 
	//font through font transformer, the label doesn't get really far away from the vertex
	StringBuilder html = new StringBuilder();
	html.append( "<html><!--" ).append( vertex.getURI() ).append( "-->" );
	boolean first = true;
	for ( URI property : propertiesList ) {
		if ( vertex.hasProperty( property ) ) {
			if ( first ) {
				first = false;
			}
			else {
				html.append( "<font size='1'><br></font>" );
			}

			if ( displayLabelFor( property ) ) {
				String label = getLabel( property );
				html.append( label ).append( ": " );
			}

			Value val = vertex.getValue( property );
			String propval = ( RDF.TYPE.equals( property )
					? getLabel( URI.class.cast( val ) ) : val.stringValue() );
			html.append( chop( propval, 50 ) );
		}
	}

	html.append( "</html>" );

	return html.toString();
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:41,代码来源:LabelTransformer.java

示例14: getString

import org.openrdf.model.Value; //导入方法依赖的package包/类
public String getString() {
	// if we used the one-URI ctor, get the (only) value, or null
	Value v = getOne();
	return ( null == v ? null : v.stringValue() );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:6,代码来源:MetadataQuery.java

示例15: create

import org.openrdf.model.Value; //导入方法依赖的package包/类
@Override
	public void create( List<Value[]> data, List<String> headers, IEngine engine ) {
		setHeaders( headers );
		convertUrisToLabels( data, engine );
		
		Set<Map<String, Object>> hashes = new HashSet<>();
		
		for ( Value[] listElement : data ) {
			Map<String, Object> elementHash = new LinkedHashMap<>();
			String colName;
			Double value;
			for ( int j = 0; j < headers.size(); j++ ) {
				Value v = listElement[j];
				colName = headers.get( j );
				Class<?> k = RDFDatatypeTools.getClassForValue( v );
				
				elementHash.put( "size", 1000000 );
				if ( k.equals( String.class ) ){
					String text = v.stringValue();
					elementHash.put( colName, text );
				}
				else {
					value = Literal.class.cast( listElement[j] ).doubleValue();
					elementHash.put( colName, value );
				}
			}
			hashes.add( elementHash );
		}

		Map<String, Object> allHash = new HashMap<>();
		allHash.put( "dataSeries", hashes );

		allHash.put( "lat", "lat" );
		allHash.put( "lon", "lon" );
		allHash.put( "size", "size" );
		allHash.put( "locationName", headers.get(  0 ) );
//		allHash.put("xAxisTitle", var[0]);
//		allHash.put("yAxisTitle", var[1]);
//		allHash.put("value", var[2]);

		addDataHash( allHash );
		createView();
	}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:44,代码来源:CONUSMapPlaySheet.java


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