本文整理汇总了Java中com.hp.hpl.jena.vocabulary.XSD类的典型用法代码示例。如果您正苦于以下问题:Java XSD类的具体用法?Java XSD怎么用?Java XSD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSD类属于com.hp.hpl.jena.vocabulary包,在下文中一共展示了XSD类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: nodeType
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
private String nodeType(RDFNode node) {
if (node.isURIResource()) {
return "IRI";
}
if (node.isAnon()) {
return "blank node";
}
if (!"".equals(node.asLiteral().getLanguage())) {
return "language-tagged string";
}
if (node.asLiteral().getDatatypeURI() == null) {
return "plain literal";
}
if (XSD.xstring.getURI().equals(node.asLiteral().getDatatypeURI())) {
return "string literal";
}
return "non-string typed literal";
}
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:19,代码来源:PlainTextMessageRenderer.java
示例2: SQLExactNumeric
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
/**
* @param jdbcType Constant from {@link java.sql.Types}
* @param unsigned This is now being ignored because R2RML just maps everything to xsd:integer
*/
public SQLExactNumeric(String name, int jdbcType, boolean unsigned) {
super(name);
switch (jdbcType) {
case Types.NUMERIC: rdfType = XSD.decimal.getURI(); break;
case Types.DECIMAL: rdfType = XSD.decimal.getURI(); break;
// case Types.TINYINT: rdfType = unsigned ? "xsd:unsignedByte" : "xsd:byte"; break;
// case Types.SMALLINT: rdfType = unsigned ? "xsd:unsignedShort" : "xsd:short"; break;
// case Types.INTEGER: rdfType = unsigned ? "xsd:unsignedInt" : "xsd:int"; break;
// case Types.BIGINT: rdfType = unsigned ? "xsd:unsignedLong" : "xsd:long"; break;
case Types.TINYINT: rdfType = XSD.integer.getURI(); break;
case Types.SMALLINT: rdfType = XSD.integer.getURI(); break;
case Types.INTEGER: rdfType = XSD.integer.getURI(); break;
case Types.BIGINT: rdfType = XSD.integer.getURI(); break;
default: rdfType = XSD.decimal.getURI();
}
}
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:21,代码来源:SQLExactNumeric.java
示例3: getNodeType
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
private NodeType getNodeType(ColumnOrTemplateValuedTermMap termMap, Position position, DataType naturalType) {
if (termMap.getTermType(position) == TermType.IRI) {
return TypedNodeMaker.URI;
}
if (termMap.getTermType(position) == TermType.BLANK_NODE) {
return TypedNodeMaker.BLANK;
}
if (termMap.getLanguageTag() != null) {
return TypedNodeMaker.languageLiteral(
termMap.getLanguageTag().toString());
}
if (termMap.getDatatype() != null) {
return TypedNodeMaker.typedLiteral(
TypeMapper.getInstance().getSafeTypeByName(termMap.getDatatype().toString()));
}
if (!XSD.xstring.getURI().equals(naturalType.rdfType())) {
return TypedNodeMaker.typedLiteral(TypeMapper.getInstance().getSafeTypeByName(naturalType.rdfType()));
}
return TypedNodeMaker.PLAIN_LITERAL;
}
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:21,代码来源:R2RMLCompiler.java
示例4: generateColumnProperty
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
public void generateColumnProperty(Property property,
TableName table, Identifier column, DataType datatype) {
PropertyBridge bridge = new PropertyBridge(getPropertyBridgeResource(table, column));
bridge.setBelongsToClassMap(getClassMap(table));
bridge.addProperty(property);
if (generateDefinitionLabels) {
bridge.addDefinitionLabel(model.createLiteral(
table.getTable().getName() + " " + column.getName()));
}
bridge.setColumn(table.qualifyIdentifier(column));
String datatypeURI = datatype.rdfType();
if (datatypeURI != null && !XSD.xstring.getURI().equals(datatypeURI)) {
// We use plain literals instead of xsd:strings, so skip
// this if it's an xsd:string
bridge.setDatatype(datatypeURI);
}
if (datatype.valueRegex() != null) {
bridge.addValueRegex(datatype.valueRegex());
}
}
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:21,代码来源:D2RQTarget.java
示例5: supportXsdType
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
public boolean supportXsdType(Resource type) {
if (owlProfileId == OwlProfileEnum.OWL2_EL || owlProfileId == OwlProfileEnum.OWL2_QL) {
if (type.equals(XSD.xboolean)) {
//
// The following datatypes must not be used in OWL 2 EL and OWL 2 QL) ||
// xsd) ||boolean, xsd) ||double, xsd) ||float, xsd) ||XXXInteger (exception xsd) ||integer and xsd) ||nonNegativeInteger),
// xsd) ||long, xsd) ||int, xsd) ||short, xsd) ||byte, xsd) ||unsignedXXX, xsd) ||language
// See) || http) ||//www.w3.org/TR/owl2-profiles/#Entities
// See) || http) ||//www.w3.org/TR/owl2-profiles/#Entities2
//
return false;
}
}
//
// OWL1 supports almost all types) ||
// See) || http) ||//www.w3.org/TR/owl-ref/#rdf-datatype
//
return true;
}
开发者ID:Web-of-Building-Data,项目名称:Ifc2Rdf,代码行数:21,代码来源:OwlProfile.java
示例6: exportEnumerationTypeInfo
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
private void exportEnumerationTypeInfo(IfcEnumerationTypeInfo typeInfo) {
String typeUri = super.formatTypeName(typeInfo);
Resource typeResource = createUriResource(typeUri);
if (!context.isEnabledOption(Ifc2RdfConversionOptionsEnum.ForceConvertEnumerationValuesToString)) {
adapter.exportTriple(typeResource, RDF.type, OWL.Class);
List<Resource> nodes = new ArrayList<>();
List<String> enumValues = typeInfo.getValues();
for (String value : enumValues) {
nodes.add(super.createUriResource(super.formatOntologyName(value)));
}
RDFList rdfList = super.createList(nodes);
adapter.exportTriple(typeResource, OWL.oneOf, rdfList);
} else {
adapter.exportTriple(typeResource, RDF.type, RDFS.Datatype);
adapter.exportTriple(typeResource, RDFS.subClassOf, XSD.xstring);
// List<String> values = typeInfo.getValues();
// String valueString = StringUtils.collectionToString(values, "(", ")", String.format("\"%%s\"^^%s", RdfVocabulary.XSD_STRING.getShortForm()), " ");
// adapter.writeRdfTriple(ExportAdapter.CURRENT_SUBJECT, OWL.oneOf, valueString);
}
}
开发者ID:Web-of-Building-Data,项目名称:Ifc2Rdf,代码行数:25,代码来源:Ifc2RdfSchemaExporter.java
示例7: supportXsdType
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
public boolean supportXsdType(Resource type) {
if (owlProfileId == OwlProfileEnum.OWL2_EL || owlProfileId == OwlProfileEnum.OWL2_QL) {
if (type.equals(XSD.xboolean) || type.equals(XSD.xdouble)) {
//
// The following datatypes must not be used in OWL 2 EL and OWL 2 QL) ||
// xsd) ||boolean, xsd) ||double, xsd) ||float, xsd) ||XXXInteger (exception xsd) ||integer and xsd) ||nonNegativeInteger),
// xsd) ||long, xsd) ||int, xsd) ||short, xsd) ||byte, xsd) ||unsignedXXX, xsd) ||language
// See) || http) ||//www.w3.org/TR/owl2-profiles/#Entities
// See) || http) ||//www.w3.org/TR/owl2-profiles/#Entities2
//
return false;
}
} else if (owlProfileId == OwlProfileEnum.OWL2_RL) {
if (type.equals(RdfVocabulary.OWL.real)) {
return false;
}
}
//
// OWL1 supports almost all types) ||
// See) || http) ||//www.w3.org/TR/owl-ref/#rdf-datatype
//
return true;
}
开发者ID:Web-of-Building-Data,项目名称:Ifc2Rdf,代码行数:25,代码来源:OwlProfile.java
示例8: getXsdTypeForDoubleValues
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
protected Resource getXsdTypeForDoubleValues() {
if (typeForDoubleValues == null) {
List<Resource> types = new ArrayList<>();
if (context.isEnabledOption(Ifc2RdfConversionOptionsEnum.UseSpecificDoubleTypes)) {
types.add(XSD.xdouble);
types.add(RdfVocabulary.OWL.real);
}
types.add(XSD.decimal);
typeForDoubleValues = context.getOwlProfileList().getFirstSupportedType(types);
}
return typeForDoubleValues;
}
开发者ID:Web-of-Building-Data,项目名称:Ifc2Rdf,代码行数:17,代码来源:Ifc2RdfExporterBase.java
示例9: setModelPrefix
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
public static void setModelPrefix(Model model){
model.setNsPrefix("biopax", Biopax_level3.getURI());
model.setNsPrefix("gpml", Gpml.getURI());
model.setNsPrefix("wp", Wp.getURI());
model.setNsPrefix("xsd", XSD.getURI());
model.setNsPrefix("rdf", RDF.getURI());
model.setNsPrefix("rdfs", RDFS.getURI());
model.setNsPrefix("dcterms", DCTerms.getURI());
model.setNsPrefix("wprdf", "http://rdf.wikipathways.org/");
model.setNsPrefix("foaf", FOAF.getURI());
model.setNsPrefix("dc", DC.getURI());
model.setNsPrefix("skos", Skos.getURI());
model.setNsPrefix("void", Void.getURI());
model.setNsPrefix("wprdf", "http://rdf.wikipathways.org/");
model.setNsPrefix("pav", Pav.getURI());
model.setNsPrefix("prov", Prov.getURI());
model.setNsPrefix("dcterms", DCTerms.getURI());
model.setNsPrefix("freq", Freq.getURI());
}
开发者ID:wikipathways,项目名称:GPML2RDF,代码行数:20,代码来源:Utils.java
示例10: fillupPropertyTable
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
private void fillupPropertyTable()
{
ArrayList<CSVHeader> ar = new ArrayList<>();
ar.addAll(Arrays.asList(this.currentSelectedClass.loadHeaders()));
PropertyTableModel model = new PropertyTableModel(ar);
model.dataSource = this;
List<CLDataType> lds = new ArrayList<>();
lds.add(new CLDataType(XSD.xboolean));
lds.add(new CLDataType(XSD.xbyte));
lds.add(new CLDataType(XSD.xdouble));
lds.add(new CLDataType(XSD.xfloat));
lds.add(new CLDataType(XSD.xint));
lds.add(new CLDataType(XSD.xlong));
lds.add(new CLDataType(XSD.xshort));
lds.add(new CLDataType(XSD.xstring));
lds.add(new CLDataType(XSD.date));
lds.add(new CLDataType(XSD.dateTime));
lds.add(new CLDataType(XSD.decimal));
this.propertyTable.setModel(model);
this.propertyTable.setDefaultRenderer(CLDataType.class, new DataTypeCellRenderer());
this.propertyTable.setDefaultEditor(CLDataType.class, new DataTypeCellEditor(lds));
this.propertyTable.setRowHeight(25);
}
开发者ID:kumarsharma,项目名称:CSV2LOD,代码行数:26,代码来源:OntClassVerifierView.java
示例11: dataset12
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
public SparqlifyDataset dataset12() {
String content =
"<http://ex.org/Class01> <" + RDF.type.getURI() + "> <" + RDFS.Class.getURI() + "> ." +
"<http://ex.org/Class02> <" + RDF.type.getURI() + "> <" + RDFS.Class.getURI() + "> ." +
"<http://ex.org/res/01> <" + RDF.type.getURI() + "> <http://ex.org/Class01> ." +
"<http://ex.org/res/02> <" + RDF.type.getURI() + "> <http://ex.org/Class02> ." +
"<http://ex.org/prop01> <" + RDF.type.getURI() + "> <" + OWL.DatatypeProperty.getURI() + "> ." +
"<http://ex.org/prop02> <" + RDF.type.getURI() + "> <" + RDF.Property.getURI() + "> ." +
"<http://ex.org/prop02> <http://ex.org/prop01> \"23\"^^<" + XSD.integer.getURI() + "> .";
SparqlifyDataset dataset = new SparqlifyDataset();
dataset.registerDump(new StringReader(content));
dataset.read(new StringReader(content), null, "TTL");
return dataset;
}
开发者ID:SmartDataAnalytics,项目名称:R2RLint,代码行数:17,代码来源:NoResourceNameClashesTest.java
示例12: dataset13
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
public SparqlifyDataset dataset13() {
String content =
"<http://ex.org/Class01> <" + RDF.type.getURI() + "> <" + RDFS.Class.getURI() + "> ." +
"<http://ex.org/Class02> <" + RDF.type.getURI() + "> <" + RDFS.Class.getURI() + "> ." +
"<http://ex.org/res/01> <" + RDF.type.getURI() + "> <http://ex.org/Class01> ." +
"<http://ex.org/res/02> <" + RDF.type.getURI() + "> <http://ex.org/Class02> ." +
"<http://ex.org/prop01> <" + RDF.type.getURI() + "> <" + OWL.ObjectProperty.getURI() + "> ." +
"<http://ex.org/prop02> <" + RDF.type.getURI() + "> <" + RDF.Property.getURI() + "> ." +
"<http://ex.org/prop02> <http://ex.org/prop01> \"23\"^^<" + XSD.integer.getURI() + "> .";
SparqlifyDataset dataset = new SparqlifyDataset();
dataset.registerDump(new StringReader(content));
dataset.read(new StringReader(content), null, "TTL");
return dataset;
}
开发者ID:SmartDataAnalytics,项目名称:R2RLint,代码行数:17,代码来源:NoResourceNameClashesTest.java
示例13: getGlobalPrefix
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
public String getGlobalPrefix(String uri) {
if (globalPrefixes != null) {
String prefix = globalPrefixes.get(uri);
if ((prefix == null || prefix.length() == 0) && uri.endsWith("#")) {
prefix = globalPrefixes.get(uri.substring(0, uri.length() - 1));
}
if (prefix != null) {
return prefix;
}
}
if (uri.equals(RDF.getURI())) {
return "rdf";
}
else if (uri.equals(RDFS.getURI())) {
return "rdfs";
}
else if (uri.equals(OWL.getURI())) {
return "owl";
}
else if (uri.equals(XSD.getURI())) {
return "xsd";
}
return null;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:25,代码来源:ConfigurationManager.java
示例14: rangeToString
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
private String rangeToString(OntProperty prop) {
ExtendedIterator<? extends OntResource> ritr = prop.listRange();
String rng = "";
int cnt = 0;
while (ritr.hasNext()) {
OntResource rngNode = ritr.next();
if (!rngNode.isAnon() && rngNode.getNameSpace().equals(XSD.getURI())) {
rng += rngNode.getLocalName();
}
else if (rngNode.canAs(OntClass.class)) {
rng += ontClassToString((OntClass)rngNode.as(OntClass.class), null);
}
else {
rng += rngNode.toString();
}
cnt++;
}
if (cnt > 1) {
rng = "{" + rng + "}";
}
return rng;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:23,代码来源:OwlToSadl.java
示例15: validate
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
public boolean validate(Expression expr, String xsdType, String op, StringBuilder errorMessageBuilder) {
List<String> operations = Arrays.asList(op.split("\\s+"));
TypeCheckInfo exprTypeCheckInfo;
try {
exprTypeCheckInfo = getType(expr);
NamedNode tctype = getModelProcessor().validateNamedNode(new NamedNode(XSD.xint.getURI(), NodeType.DataTypeNode));
ConceptName numberLiteralConceptName = getModelProcessor().namedNodeToConceptName(tctype);
numberLiteralConceptName.setType(ConceptType.RDFDATATYPE);
TypeCheckInfo xsdTypeCheckInfo = new TypeCheckInfo(numberLiteralConceptName, tctype, this, null);
if(!compareTypes(operations, expr, null, exprTypeCheckInfo, xsdTypeCheckInfo, ImplicitPropertySide.NONE)){
if (createErrorMessage(errorMessageBuilder, exprTypeCheckInfo, xsdTypeCheckInfo, op, true, expr)) {
return false;
}
}
} catch (Throwable t) {
return handleValidationException(expr, t);
}
return true;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:20,代码来源:JenaBasedSadlModelValidator.java
示例16: getType
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
private TypeCheckInfo getType(SadlConstantLiteral expression) throws TranslationException, InvalidNameException, InvalidTypeException {
String term = expression.getTerm();
Literal litval = null;
if (term.equals(SadlConstants.CONSTANT_PI)) {
litval = theJenaModel.createTypedLiteral(Math.PI);
}
else if (term.equals(SadlConstants.CONSTANT_E)) {
litval = theJenaModel.createTypedLiteral(Math.E);
}
else {
throw new TranslationException("Unhandled SadlConstantLiteral type: " + expression.getClass().getCanonicalName());
}
NamedNode tctype = getModelProcessor().validateNamedNode(new NamedNode(XSD.decimal.getURI(), NodeType.DataTypeNode));
ConceptName numberLiteralConceptName = getModelProcessor().namedNodeToConceptName(tctype);
TypeCheckInfo litTci = new TypeCheckInfo(numberLiteralConceptName, litval, ExplicitValueType.VALUE, this, expression);
litTci.setTypeCheckType(tctype);
return litTci;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:19,代码来源:JenaBasedSadlModelValidator.java
示例17: checkDataPropertyValueInRange
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
public boolean checkDataPropertyValueInRange(OntModel theJenaModel2, Resource subj, OntProperty prop, Literal val) {
OntResource rng = prop.getRange();
if (rng == null) {
return true;
}
String ptype = prop.getRange().getURI();
if (ptype == null) {
return true;
}
String dtype = val.getDatatypeURI();
if (dtype.equals(ptype)) {
return true;
}
if (dtype.equals(XSD.xint.getURI())) { // the literal is an integer
if (ptype.equals(XSD.integer.getURI())) return true;
if (ptype.equals(XSD.xlong.getURI())) return true;
}
return false;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:20,代码来源:JenaBasedSadlModelValidator.java
示例18: getLiteralType
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
private Resource getLiteralType(Node lit_obj){
RDFNode n = Commons.asRDFNode(lit_obj);
Literal lt = (Literal) n;
if (((Literal)n).getDatatype() != null){
return ModelFactory.createDefaultModel().createResource(lt.getDatatype().getURI());
} else {
if (lt.getValue() instanceof Byte) return XSD.xbyte;
else if (lt.getValue() instanceof Boolean) return XSD.xboolean;
else if (lt.getValue() instanceof Short) return XSD.xshort;
else if (lt.getValue() instanceof Integer) return XSD.xint;
else if (lt.getValue() instanceof Long) return XSD.xlong;
else if (lt.getValue() instanceof Float) return XSD.xfloat;
else if (lt.getValue() instanceof Double) return XSD.xdouble;
else if (lt.getValue() instanceof String) return XSD.xstring;
else return RDFS.Literal;
}
}
开发者ID:diachron,项目名称:quality,代码行数:19,代码来源:UsageOfIncorrectDomainOrRangeDatatypes.java
示例19: getLiteralType
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
private Resource getLiteralType(Node lit_obj){
RDFNode n = Commons.asRDFNode(lit_obj);
if (((Literal)n).getDatatype() != null){
return ModelFactory.createDefaultModel().createResource(lit_obj.getLiteralDatatype().getURI());
} else {
Literal lt = (Literal) n;
if (lt.getValue() instanceof Double) return XSD.xdouble;
else if (lt.getValue() instanceof Integer) return XSD.xint;
else if (lt.getValue() instanceof Boolean) return XSD.xboolean;
else if (lt.getValue() instanceof String) return XSD.xstring;
else if (lt.getValue() instanceof Float) return XSD.xfloat;
else if (lt.getValue() instanceof Short) return XSD.xshort;
else if (lt.getValue() instanceof Long) return XSD.xlong;
else if (lt.getValue() instanceof Byte) return XSD.xbyte;
else return RDFS.Literal;
}
}
开发者ID:diachron,项目名称:quality,代码行数:19,代码来源:PredicateClusteringIndexing.java
示例20: OntologyTarget
import com.hp.hpl.jena.vocabulary.XSD; //导入依赖的package包/类
public OntologyTarget() {
model.setNsPrefix("rdf", RDF.getURI());
model.setNsPrefix("rdfs", RDFS.getURI());
model.setNsPrefix("owl", OWL.getURI());
model.setNsPrefix("dc", DC.getURI());
model.setNsPrefix("xsd", XSD.getURI());
}
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:8,代码来源:OntologyTarget.java
注:本文中的com.hp.hpl.jena.vocabulary.XSD类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论