本文整理汇总了Java中com.hp.hpl.jena.datatypes.RDFDatatype.equals方法的典型用法代码示例。如果您正苦于以下问题:Java RDFDatatype.equals方法的具体用法?Java RDFDatatype.equals怎么用?Java RDFDatatype.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.datatypes.RDFDatatype
的用法示例。
在下文中一共展示了RDFDatatype.equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: typedLiteral
import com.hp.hpl.jena.datatypes.RDFDatatype; //导入方法依赖的package包/类
public static NodeType typedLiteral(RDFDatatype datatype) {
// TODO These subclasses can be abolished; just introduce an RDFDatatypeValidator instead
if (datatype.equals(XSDDatatype.XSDdate)) {
return XSD_DATE;
}
if (datatype.equals(XSDDatatype.XSDtime)) {
return XSD_TIME;
}
if (datatype.equals(XSDDatatype.XSDdateTime)) {
return XSD_DATETIME;
}
if (datatype.equals(XSDDatatype.XSDboolean)) {
return XSD_BOOLEAN;
}
return new LiteralNodeType("", datatype);
}
示例2: normalizeSubType
import com.hp.hpl.jena.datatypes.RDFDatatype; //导入方法依赖的package包/类
/**
* Normalization. If the value is narrower than the current data type
* (e.g. value is xsd:date but the time is xsd:datetime) returns
* the narrower type for the literal.
* If the type is narrower than the value then it may normalize
* the value (e.g. set the mask of an XSDDateTime)
* Currently only used to narrow gener XSDDateTime objects
* to the minimal XSD date/time type.
* @param value the current object value
* @param dt the currently set data type
* @return a narrower version of the datatype based on the actual value range
*/
@Override
public RDFDatatype normalizeSubType(Object value, RDFDatatype dt) {
if (value instanceof XSDDateTime) {
if (dt.equals(XSDDatatype.XSDdateTime)) {
return ((XSDDateTime)value).getNarrowedDatatype();
} else if (dt instanceof XSDDatatype){
// We've externally narrowed the type, push this down to the date time
((XSDDateTime)value).narrowType((XSDDatatype)dt);
}
}
return this;
}
示例3: isSupported
import com.hp.hpl.jena.datatypes.RDFDatatype; //导入方法依赖的package包/类
public static boolean isSupported(RDFDatatype datatype)
{
return datatype == null || isNumeric(datatype) || datatype.equals(XSDDatatype.XSDdateTime) || datatype.equals(XSDDatatype.XSDstring);
}
示例4: addProperty
import com.hp.hpl.jena.datatypes.RDFDatatype; //导入方法依赖的package包/类
/** Small utility to add a property to a semantic object.
*
* @param parent
* @param s
* @throws SemanticObjectBuilderException
*/
protected static void addProperty (
SemanticObjectBuilder builder,
SemanticObject parent,
Statement s
)
throws SemanticObjectBuilderException
{
String propUri = s.getPredicate().getURI();
// we skip adding owl:sameAs properties
if (propUri.equals(OWLSameAsURI) || propUri.equals(OWLDifferentFromURI))
return;
logger.info(" addProperty:"+propUri+" isResource:"+s.getObject().isResource());
// Special case: setting rdf:type properties for SO
if (propUri.equals(RDFTypeURI)) {
if (s.getObject().isResource()) {
Resource r = (Resource) s.getObject().as(Resource.class);
if (r.getURI()!= null && !r.getURI().equals(OWLThingURI)) {
// add type only if NOT owl:Thing, which is a duplicate
parent.addRDFTypeURI(Utility.createURI(r.getURI()));
}
} else {
logger.warn(" Can't do anything with non-resource rdf:type in serialization? dropping information on floor..");
}
return;
}
// other types of properties treated here
if (s.getObject().canAs(Individual.class))
{
Individual in = builder.ontModel.getIndividual(s.getObject().toString());
logger.debug(" #### looking for individual w/ uri:"+s.getObject()+" result:"+in);
// if (in != null) { logger.debug(" prop value is Individual : "+in.getURI()); }
SemanticObject target = builder.createSemanticObject((Individual) s.getObject().as(Individual.class));
if (target != null)
parent.addProperty(Utility.createURI(propUri), target);
else
// is this really an issue? log at warn level for now
logger.warn("Skipping addProperty for prop:"+propUri+", target object is null");
} else if (s.getObject().canAs(Literal.class)) {
logger.debug(" prop value is Literal, add datatype prop");
Literal l = (Literal) s.getObject().as(Literal.class);
RDFDatatype dtype = l.getDatatype();
if (dtype == null || dtype.equals(XSDDatatype.XSDstring))
parent.addProperty(Utility.createURI(propUri), l.getString());
else
parent.addProperty(Utility.createURI(propUri), l.toString());
} else {
if(s.getObject().isLiteral())
{
parent.addProperty(Utility.createURI(propUri), s.getObject().toString());
}
}
}