All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ontoware.rdf2go.model.impl.QueryRowImpl Maven / Gradle / Ivy

Go to download

RDF2go is an implementation-independent Java API with the design goals: portability (hence the name), performance and ease of implementation. This project was started at FZI Forschungszentrum Informatik Karlsruhe, Germany - www.fzi.de

The newest version!
/**
 * LICENSE INFORMATION
 * 
 * Copyright 2005-2008 by FZI (http://www.fzi.de). Licensed under a BSD license
 * (http://www.opensource.org/licenses/bsd-license.php)  = Max Völkel
 *  = FZI Forschungszentrum Informatik Karlsruhe, Karlsruhe,
 * Germany  = 2010
 * 
 * Further project information at http://semanticweb.org/wiki/RDF2Go
 */

package org.ontoware.rdf2go.model.impl;

import java.util.HashMap;
import java.util.Map;

import org.ontoware.rdf2go.exception.ModelRuntimeException;
import org.ontoware.rdf2go.model.QueryRow;
import org.ontoware.rdf2go.model.node.Literal;
import org.ontoware.rdf2go.model.node.Node;


public class QueryRowImpl extends HashMap implements QueryRow {
	
	private static final long serialVersionUID = 1496910590032007736L;
	
	@Override
    public Node getValue(String varname) {
		return super.get(varname);
	}
	
	@Override
    public String getLiteralValue(String varname) throws ModelRuntimeException {
		Node n = super.get(varname);
		if(n instanceof Literal)
			return ((Literal)n).getValue();
		// else
		throw new ModelRuntimeException("Node is not a literal");
	}
	
	@Override
	public String toString() {
		StringBuffer buf = new StringBuffer();
		
		for(Map.Entry entry : this.entrySet()) {
			buf.append(entry.getKey()).append(":").append(entry.getValue());
			buf.append(", ");
		}
		
		return buf.toString();
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy