本文整理汇总了Java中com.hp.hpl.jena.vocabulary.XSD类的典型用法代码示例。如果您正苦于以下问题:Java XSD类的具体用法?Java XSD怎么用?Java XSD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSD类属于com.hp.hpl.jena.vocabulary包,在下文中一共展示了XSD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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";
}
示例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();
}
}
示例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;
}
示例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());
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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());
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}