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

org.aksw.jena_sparql_api.relationlet.RelationletEntry Maven / Gradle / Ivy

There is a newer version: 5.2.0-1
Show newest version
package org.aksw.jena_sparql_api.relationlet;

import java.util.function.Function;

import org.apache.jena.sparql.core.Var;

public class RelationletEntry {
	protected T relationlet;
	//protected String label; // Allow multiple labels?
	protected String id;

	public RelationletEntry(String id, T relationlet) {
		super();
		this.id = id;
		this.relationlet = relationlet;
		//this.label = label;
	}
	
	/**
	 * Create a var ref to a variable to the relationlet wrapped by this specific entry. 
	 * 
	 * @param var
	 * @return
	 */
	public VarRef createVarRef(Var var) {
		// TODO Would be nicer having a specific sub-type of VarRef for constant vars
		VarRef result = createVarRef(x -> var);
		return result;
	}
	
	public VarRefEntry createVarRef(Function varAccessor) {
		VarRefEntry result = new VarRefEntryFnImpl(this, varAccessor);
		return result;
	}
	
	
	public T getRelationlet() {
		return relationlet;
	}
//	public String getLabel() {
//		return label;
//	}
	

	// Internal identifier allocated for this entry
	public String getId() {
		return id;
	}

	@Override
	public String toString() {
		return "" + id + ": " + relationlet;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy