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

com.eduworks.cruncher.ontology.CruncherOntologyId Maven / Gradle / Ivy

There is a newer version: 5.16.4
Show newest version
package com.eduworks.cruncher.ontology;

import java.io.InputStream;
import java.util.Map;

import org.json.JSONException;
import org.json.JSONObject;

import com.eduworks.ontology.Ontology;
import com.eduworks.resolver.Context;
import com.eduworks.resolver.Cruncher;


public class CruncherOntologyId extends Cruncher {

	@Override
	public Object resolve(Context c,
			Map parameters, Map dataStreams) throws JSONException {
		
		String id = decodeValue(optAsString("id","", c,parameters, dataStreams));
		
		if(!id.startsWith(Ontology.idCharacter)){
			return Ontology.idCharacter+id;
		}else{
			return id;
		}
	
	}

	@Override
	public String getDescription() {
		return "Converts the Id passed in to an ontologyId (@-sign at beginning)";
	}

	@Override
	public String getReturn() {
		return "string";
	}

	@Override
	public String getAttribution() {
		return ATTRIB_NONE;
	}

	@Override
	public JSONObject getParameters() throws JSONException {
		return jo("id", "string");
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy