當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。