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

it.uniroma2.art.sheet2rdf.pearl.GraphPearlElementPatternBased Maven / Gradle / Ivy

There is a newer version: 6.0.6
Show newest version
package it.uniroma2.art.sheet2rdf.pearl;

import java.util.Map;

public class GraphPearlElementPatternBased extends GraphPearlElement {
	
	private String graphPattern;
	
	public GraphPearlElementPatternBased(boolean optional) {
		super(optional);
	}
	
	public void setGraphPattern(String graphPattern) {
		this.graphPattern = graphPattern;
	}

	@Override
	public String serialize(String tabs, Map prefixMapping) {
		String output = graphPattern;
		if (optional){
			output = output.replace("\n", "\n\t" + tabs);
			output = output.replace("(\r\n|\n)", "$1\t" + tabs);
			output = tabs + "OPTIONAL {\n\t" + tabs + output + "\n" + tabs + "}";
		}
		return output;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy