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


Java RDFS类代码示例

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


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

示例1: init

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
public void init(String db, String uri, String lucene) {

    	Dataset ds = TDBFactory.createDataset(db);
        
        // Lucene configuration
        try {
            Directory luceneDir = FSDirectory.open(new File(lucene));
            EntityDefinition entDef = new EntityDefinition("comment", "text", RDFS.comment);
            // Set uid in order to remove index entries automatically
            entDef.setUidField("uid");
            StandardAnalyzer stAn = new StandardAnalyzer(Version.LUCENE_4_9);
            dataset = TextDatasetFactory.createLucene(ds, luceneDir, entDef, stAn);
            
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        baseURI = uri;
        servers = new ArrayList<>();
        tdQueue = new PriorityQueue<ThingDescription>();
        loadTDQueue();
    }
 
开发者ID:thingweb,项目名称:thingweb-directory,代码行数:24,代码来源:ThingDirectory.java

示例2: GraphCreator

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
public GraphCreator() {
    // Initialize the classes
    classes = new ObjectObjectOpenHashMap<Resource, HierarchyNode>();
    classes.put(RDFS.Class, new HierarchyNode());
    classes.put(OWL.Class, new HierarchyNode());
    classes.put(RDF.Property, new HierarchyNode());
    vertexPalette = new InMemoryPalette();
    vertexPalette.addColour(RDFS.Class.getURI());
    vertexPalette.setColour(OWL.Class.getURI(), vertexPalette.getColour(RDFS.Class.getURI()));
    vertexPalette.addColour(RDF.Property.getURI());
    // Initialize the properties
    properties = new ObjectObjectOpenHashMap<Resource, HierarchyNode>();
    properties.put(RDF.type, new HierarchyNode());
    edgePalette = new InMemoryPalette();
    edgePalette.addColour(RDF.type.getURI());
}
 
开发者ID:dice-group,项目名称:Lemming,代码行数:17,代码来源:GraphCreator.java

示例3: addBenchmark

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
/**
 * Adds the given benchmark to the given model and returns the created
 * {@link Resource} of the benchmark. Note that the list of systems (
 * {@link BenchmarkBean#systems}) is not added to the model.
 *
 * @param benchmark
 *            the bean containing the information about the benchmark that
 *            should be added
 * @param model
 *            the RDF model to which the benchmark should be added
 * @return the {@link Resource} representing the newly created benchmark
 */
public static Resource addBenchmark(BenchmarkBean benchmark, Model model) {
    Resource benchmarkResource = model.getResource(benchmark.getId());
    model.add(benchmarkResource, RDF.type, HOBBIT.Benchmark);
    if ((benchmark.getName() != null) && (!benchmark.getName().equals(benchmark.getId()))) {
        model.add(benchmarkResource, RDFS.label, benchmark.getName(), "en");
    }
    if ((benchmark.getDescription() != null) && (!benchmark.getDescription().equals(benchmark.getId()))) {
        model.add(benchmarkResource, RDFS.comment, benchmark.getDescription(), "en");
    }
    if (benchmark.getConfigurationParams() != null) {
        Resource paramResource;
        for (ConfigurationParamBean parameter : benchmark.getConfigurationParams()) {
            paramResource = addParameter(parameter, model);
            model.add(benchmarkResource, HOBBIT.hasParameter, paramResource);
        }
    }
    if (benchmark.getKpis() != null){
        Resource kpiResource;
        for (KeyPerformanceIndicatorBean kpi : benchmark.getKpis()) {
            kpiResource = addKpi(kpi, model);
            model.add(benchmarkResource, HOBBIT.measuresKPI, kpiResource);
        }
    }
    return benchmarkResource;
}
 
开发者ID:hobbit-project,项目名称:platform,代码行数:38,代码来源:RdfModelCreationHelper.java

示例4: addKpi

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
private static Resource addKpi(KeyPerformanceIndicatorBean kpi, Model model) {
    Resource kpiResource = model.getResource(kpi.getId());
    model.add(kpiResource, RDF.type, HOBBIT.KPI);
    if ((kpi.getName() != null) && (!kpi.getName().equals(kpi.getId()))) {
        model.add(kpiResource, RDFS.label, kpi.getName(), "en");
    }
    if ((kpi.getDescription() != null) && (!kpi.getDescription().equals(kpi.getId()))) {
        model.add(kpiResource, RDFS.comment, kpi.getDescription(), "en");
    }
    if (kpi.getDatatype() != null) {
        XSDDatatype datatype = datatypeToXsd(kpi.getDatatype());
        if (datatype != null) {
            model.add(kpiResource, RDFS.range, model.getResource(datatype.getURI()));
        }
    } if (kpi.getRanking() != null) {
        model.add(kpiResource, HOBBIT.ranking, model.getResource(kpi.getRanking()));
    }
    return kpiResource;
}
 
开发者ID:hobbit-project,项目名称:platform,代码行数:20,代码来源:RdfModelCreationHelper.java

示例5: initializeModel

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
/**
 * Initializes the Jena model and adds standard prefixes.
 */
private void initializeModel() {

	try {
		if (model != null) model.close(); // Just in case
	} catch (Exception ignored) {}

	model = ModelFactory.createDefaultModel();
	model.setNsPrefix("rdfs", RDFS.getURI());
	model.setNsPrefix("skos", SKOS.getURI());
	model.setNsPrefix("xkos", XKOS.getURI());

	logger.debug("Jena model initialized");

	return;
}
 
开发者ID:FranckCo,项目名称:Stamina,代码行数:19,代码来源:NationalRefinementsModelMaker.java

示例6: initializeModel

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
/**
 * Initializes the Jena model and adds standard prefixes.
 * 
 * @throws Exception
 */
private void initializeModel() throws Exception {

	try {
		if (model != null) model.close(); // Just in case
	} catch (Exception e) {
		logger.error("Error initializing model - " + e.getMessage());
		throw new Exception();
	}
	model = ModelFactory.createDefaultModel();
	model.setNsPrefix("rdfs", RDFS.getURI());
	model.setNsPrefix("skos", SKOS.getURI());
	model.setNsPrefix("xkos", XKOS.getURI());

	logger.debug("Jena model initialized");

	return;
}
 
开发者ID:FranckCo,项目名称:Stamina,代码行数:23,代码来源:NACECPAModelMaker.java

示例7: getSemanticLabels

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see eu.modelwriter.semantic.ISemanticProvider#getSemanticLabels(java.lang.Object)
 */
public Set<String> getSemanticLabels(Object concept) {
	final Set<String> res;

	if (concept instanceof Resource) {
		Set<String> labels = new LinkedHashSet<String>();
		final Resource resource = (Resource)concept;

		labels.addAll(JenaUtils.getLabelsForProperty(resource, RDFS.label));
		if (resource.getLocalName() != null) {
			labels.add(resource.getLocalName());
		}

		if (labels.isEmpty()) {
			res = null;
		} else {
			res = labels;
		}
	} else {
		res = null;
	}
	return res;
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:28,代码来源:JenaSemanticProvider.java

示例8: getFirstRange

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
private static Resource getFirstRange(Resource property, Set<Resource> reached) {
	Resource directRange = getFirstDirectRange(property);
	if(directRange != null) {
		return directRange;
	}
	StmtIterator it = property.listProperties(RDFS.subPropertyOf);
	while (it.hasNext()) {
		Statement ss = it.next();
		if (ss.getObject().isURIResource()) {
			Resource superProperty = ss.getResource();
			if (!reached.contains(superProperty)) {
				reached.add(superProperty);
				Resource r = getFirstRange(superProperty, reached);
				if (r != null) {
					it.close();
					return r;
				}
			}
		}
	}
	return null;
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:23,代码来源:JenaUtil.java

示例9: hasSuperClass

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
private static boolean hasSuperClass(Resource subClass, Resource superClass, Set<Resource> reached) {
	StmtIterator it = subClass.listProperties(RDFS.subClassOf);
	while(it.hasNext()) {
		Statement s = it.next();
		if(superClass.equals(s.getObject())) {
			it.close();
			return true;
		}
		else if(!reached.contains(s.getResource())) {
			reached.add(s.getResource());
			if(hasSuperClass(s.getResource(), superClass, reached)) {
				it.close();
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:19,代码来源:JenaUtil.java

示例10: init

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
private static void init(Personality<RDFNode> p) {
p.add(SHConstraintComponent.class, new SimpleImplementation(SH.ConstraintComponent.asNode(), SHConstraintComponentImpl.class));
p.add(SHJSConstraint.class, new SimpleImplementation(SH.JSConstraint.asNode(), SHJSConstraintImpl.class));
p.add(SHJSExecutable.class, new SimpleImplementation(SH.JSExecutable.asNode(), SHJSExecutableImpl.class));
p.add(SHJSFunction.class, new SimpleImplementation(SH.JSFunction.asNode(), SHJSFunctionImpl.class));
  	p.add(SHParameter.class, new SimpleImplementation(SH.Parameter.asNode(), SHParameterImpl.class));
  	p.add(SHParameterizable.class, new SimpleImplementation(SH.Parameterizable.asNode(), SHParameterizableImpl.class));
  	p.add(SHParameterizableInstance.class, new SimpleImplementation(RDFS.Resource.asNode(), SHParameterizableInstanceImpl.class));
  	p.add(SHParameterizableTarget.class, new SimpleImplementation(SH.Target.asNode(), SHParameterizableTargetImpl.class));
  	p.add(SHPropertyShape.class, new SimpleImplementation(SH.PropertyShape.asNode(), SHPropertyShapeImpl.class));
  	p.add(SHResult.class, new SimpleImplementation(SH.AbstractResult.asNode(), SHResultImpl.class));
  	p.add(SHRule.class, new SimpleImplementation(SH.Rule.asNode(), SHRuleImpl.class));
  	p.add(SHNodeShape.class, new SimpleImplementation(SH.NodeShape.asNode(), SHNodeShapeImpl.class));
p.add(SHSPARQLConstraint.class, new SimpleImplementation(SH.SPARQLConstraint.asNode(), SHSPARQLConstraintImpl.class));
p.add(SHSPARQLFunction.class, new SimpleImplementation(SH.SPARQLFunction.asNode(), SHSPARQLFunctionImpl.class));
p.add(SHSPARQLTarget.class, new SimpleImplementation(SH.SPARQLTarget.asNode(), SHSPARQLTargetImpl.class));

FunctionRegistry.get().put(TOSH.hasShape.getURI(), HasShapeFunction.class);
FunctionRegistry.get().put(TOSH.isInTargetOf.getURI(), IsInTargetOfFunction.class);
FunctionRegistry.get().put("http://spinrdf.org/spif#checkRegexSyntax", CheckRegexSyntaxFunction.class);
FunctionRegistry.get().put("http://spinrdf.org/spif#isValidForDatatype", IsValidForDatatypeFunction.class);
PropertyFunctionRegistry.get().put(TOSH.evalExpr.getURI(), EvalExprPFunction.class);
PropertyFunctionRegistry.get().put(TOSH.targetContains.getURI(), TargetContainsPFunction.class);
  }
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:25,代码来源:SHFactory.java

示例11: toString

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
@Override
   public String toString() {

	String label = JenaUtil.getStringProperty(this, RDFS.label);
	if(label != null) {
		return label;
	}
	
	String comment = JenaUtil.getStringProperty(this, RDFS.comment);
	if(comment != null) {
		return comment;
	}
	
	String message = JenaUtil.getStringProperty(this, SH.message);
	if(message != null) {
		return message;
	}

	String sparql = getSPARQL();
	if(sparql != null) {
		return sparql;
	}
	
	return "(Incomplete SPARQL Constraint)";
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:26,代码来源:SHSPARQLConstraintImpl.java

示例12: toString

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
@Override
   public String toString() {

	String label = JenaUtil.getStringProperty(this, RDFS.label);
	if(label != null) {
		return label;
	}
	
	String comment = JenaUtil.getStringProperty(this, RDFS.comment);
	if(comment != null) {
		return comment;
	}
	
	String message = JenaUtil.getStringProperty(this, SH.message);
	if(message != null) {
		return message;
	}

	String script = getFunctionName();
	if(script != null) {
		return script;
	}
	
	return "(Incomplete JavaScript Constraint)";
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:26,代码来源:SHJSConstraintImpl.java

示例13: getClassOrDatatype

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
@Override
public Resource getClassOrDatatype() {
	Resource cls = JenaUtil.getResourceProperty(this, SH.class_);
	if(cls != null) {
		return cls;
	}
	else {
		Resource datatype = JenaUtil.getResourceProperty(this, SH.datatype);
		if(datatype != null) {
			return datatype;
		}
		else {
			Resource kind = JenaUtil.getResourceProperty(this, SH.nodeKind);
			if(SH.IRI.equals(kind) || SH.BlankNode.equals(kind)) {
				return RDFS.Resource.inModel(getModel());
			}
			else if(SH.Literal.equals(kind)) {
				return RDFS.Literal.inModel(getModel());
			}
			else {
				return null;
			}
		}
	}
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:26,代码来源:SHPropertyShapeImpl.java

示例14: toString

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
@Override
   public String toString() {

	String label = JenaUtil.getStringProperty(this, RDFS.label);
	if(label != null) {
		return label;
	}
	
	String comment = JenaUtil.getStringProperty(this, RDFS.comment);
	if(comment != null) {
		return comment;
	}

	String sparql = getSPARQL();
	if(sparql != null) {
		return sparql;
	}
	
	return "(Incomplete SPARQL Target)";
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:21,代码来源:SHSPARQLTargetImpl.java

示例15: exportCollectionTypeInfoToDrummondList

import org.apache.jena.vocabulary.RDFS; //导入依赖的package包/类
private void exportCollectionTypeInfoToDrummondList(IfcCollectionTypeInfo typeInfo) {
 if (typeInfo.isSorted()) {
		
	 Resource listTypeResource = createUriResource(formatTypeName(typeInfo));
	 jenaModel.add(listTypeResource, RDF.type, OWL.Class);	
	 jenaModel.add(listTypeResource, RDFS.subClassOf, Ifc2RdfVocabulary.EXPRESS.List);
	 
	 exportPropertyDefinition(Ifc2RdfVocabulary.EXPRESS.hasNext.inModel(jenaModel),
			 listTypeResource, listTypeResource, true, 1, 1);
	 
	 Resource emptyListTypeResource = createUriResource(formatTypeName(typeInfo).replace("List", "EmptyList"));
	 jenaModel.add(emptyListTypeResource, RDF.type, OWL.Class);	
	 jenaModel.add(emptyListTypeResource, RDFS.subClassOf, listTypeResource);
	 jenaModel.add(listTypeResource, RDFS.subClassOf, Ifc2RdfVocabulary.EXPRESS.EmptyList);
	 
	 
 } else {
	 // TODO:
	 // throw new NotImplementedException(String.format("Unsorted list type: %s", typeInfo.getName()));			 
	 
 }		 
}
 
开发者ID:Web-of-Building-Data,项目名称:drumbeat-ifc2ld,代码行数:23,代码来源:Ifc2RdfExporterBase.java


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