本文整理汇总了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();
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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)";
}
示例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)";
}
示例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;
}
}
}
}
示例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)";
}
示例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()));
}
}