当前位置: 首页>>代码示例>>Java>>正文


Java SHACLFunctions类代码示例

本文整理汇总了Java中org.topbraid.shacl.arq.SHACLFunctions的典型用法代码示例。如果您正苦于以下问题:Java SHACLFunctions类的具体用法?Java SHACLFunctions怎么用?Java SHACLFunctions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SHACLFunctions类属于org.topbraid.shacl.arq包,在下文中一共展示了SHACLFunctions类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSHACLModel

import org.topbraid.shacl.arq.SHACLFunctions; //导入依赖的package包/类
public static Model getSHACLModel() {
	if(shaclModel == null) {
		
		shaclModel = JenaUtil.createDefaultModel();
		
		InputStream shaclTTL = SHACLSystemModel.class.getResourceAsStream("/rdf/shacl.ttl");
		shaclModel.read(shaclTTL, SH.BASE_URI, FileUtils.langTurtle);
		
		InputStream dashTTL = SHACLSystemModel.class.getResourceAsStream("/rdf/dash.ttl");
		shaclModel.read(dashTTL, SH.BASE_URI, FileUtils.langTurtle);
		
		InputStream toshTTL = SHACLSystemModel.class.getResourceAsStream("/rdf/tosh.ttl");
		shaclModel.read(toshTTL, SH.BASE_URI, FileUtils.langTurtle);
		
		shaclModel.add(SystemTriples.getVocabularyModel());
		
		SHACLFunctions.registerFunctions(shaclModel);
	}
	return shaclModel;
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:21,代码来源:SHACLSystemModel.java

示例2: validate

import org.topbraid.shacl.arq.SHACLFunctions; //导入依赖的package包/类
public Model validate(Model dataModel, Model shapesModel) throws Exception {
	Model shaclModel = SHACLSystemModel.getSHACLModel();
	MultiUnion unionGraph = new MultiUnion(new Graph[] {
		shaclModel.getGraph(),
		dataModel.getGraph(),
		shapesModel.getGraph()
	});
	Model all = ModelFactory.createModelForGraph(unionGraph);

	// Make sure all sh:Functions are registered
	SHACLFunctions.registerFunctions(all);
	
	URI shapesGraphURI = URI.create("urn:x-shacl-shapes-graph:" + UUID.randomUUID().toString());
	Dataset dataset = ARQFactory.get().getDataset(dataModel);
	dataset.addNamedModel(shapesGraphURI.toString(), all);
       
	Model results = new ModelConstraintValidator().validateModel(dataset, shapesGraphURI, null, true, null, null).getModel();
       results.setNsPrefixes(all);
	return results; 
}
 
开发者ID:labra,项目名称:shaclRunner,代码行数:21,代码来源:ShaclValidator.java

示例3: getSHACLModel

import org.topbraid.shacl.arq.SHACLFunctions; //导入依赖的package包/类
public static Model getSHACLModel() {
	if(shaclModel == null) {
		
		shaclModel = JenaUtil.createDefaultModel();
		
		InputStream shaclTTL = SHACLSystemModel.class.getResourceAsStream("/etc/shacl.ttl");
		shaclModel.read(shaclTTL, SH.BASE_URI, FileUtils.langTurtle);
		
		InputStream dashTTL = SHACLSystemModel.class.getResourceAsStream("/etc/dash.ttl");
		shaclModel.read(dashTTL, SH.BASE_URI, FileUtils.langTurtle);
		
		InputStream toshTTL = SHACLSystemModel.class.getResourceAsStream("/etc/tosh.ttl");
		shaclModel.read(toshTTL, SH.BASE_URI, FileUtils.langTurtle);
		
		shaclModel.add(SystemTriples.getVocabularyModel());
		
		SHACLFunctions.registerFunctions(shaclModel);
	}
	return shaclModel;
}
 
开发者ID:labra,项目名称:shaclRunner,代码行数:21,代码来源:SHACLSystemModel.java

示例4: validateModel

import org.topbraid.shacl.arq.SHACLFunctions; //导入依赖的package包/类
/**
 * Validates a given data Model against all shapes from a given shapes Model.
 * If the shapesModel does not include the system graph triples then these will be added.
 * Entailment regimes are applied prior to validation.
 * @param dataModel  the data Model
 * @param shapesModel  the shapes Model
 * @param validateShapes  true to also validate any shapes in the data Model (false is faster)
 * @return an instance of sh:ValidationReport in a results Model
 */
public static Resource validateModel(Model dataModel, Model shapesModel, boolean validateShapes) {
	
	// Ensure that the SHACL, DASH and TOSH graphs are present in the shapes Model
	if(!shapesModel.contains(TOSH.hasShape, RDF.type, (RDFNode)null)) { // Heuristic
		Model unionModel = SHACLSystemModel.getSHACLModel();
		MultiUnion unionGraph = new MultiUnion(new Graph[] {
			unionModel.getGraph(),
			shapesModel.getGraph()
		});
		shapesModel = ModelFactory.createModelForGraph(unionGraph);
	}

	// Make sure all sh:Functions are registered
	SHACLFunctions.registerFunctions(shapesModel);
	
	// Create Dataset that contains both the data model and the shapes model
	// (here, using a temporary URI for the shapes graph)
	URI shapesGraphURI = URI.create("urn:x-shacl-shapes-graph:" + UUID.randomUUID().toString());
	Dataset dataset = ARQFactory.get().getDataset(dataModel);
	dataset.addNamedModel(shapesGraphURI.toString(), shapesModel);

	ShapesGraph shapesGraph = new ShapesGraph(shapesModel);
	if(!validateShapes) {
		shapesGraph.setShapeFilter(new ExcludeMetaShapesFilter());
	}
	ValidationEngine engine = ValidationEngineFactory.get().create(dataset, shapesGraphURI, shapesGraph, null);
	try {
		engine.applyEntailments();
		return engine.validateAll();
	}
	catch(InterruptedException ex) {
		return null;
	}
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:44,代码来源:ValidationUtil.java

示例5: getValidationModel

import org.topbraid.shacl.arq.SHACLFunctions; //导入依赖的package包/类
/***************************************************************************
 * Public Static Methods
 **************************************************************************/
public static Model getValidationModel(Model shapesModel)
{
    MultiUnion unionGraph = new MultiUnion(new Graph[] {
        getSHACL().getGraph(), shapesModel.getGraph()
    });
    Model m = ModelFactory.createModelForGraph(unionGraph);

    // Make sure all sh:Functions are registered
    // Note that we don't perform validation of the shape definitions themselves.
    // To do that, activate the following line to make sure that all required triples are present:
    // dataModel = SHACLUtil.withDefaultValueTypeInferences(shapesModel);
    SHACLFunctions.registerFunctions(m);
    return m;
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:18,代码来源:TopBraidValidator.java


注:本文中的org.topbraid.shacl.arq.SHACLFunctions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。