通过耶拿检索相关数据 [英] Retrieve related data by jena
问题描述
假设我有两个类"car","jeep" ..."jeep"是
的子类
汽车",吉普车"具有子类和实例,例如速度,颜色,制造
在,汽车"中也有车辆",模型" .....我的问题是:如果我问
在耶拿(Jena)编写的有关汽车"的代码中,结果是汽车"的所有属性
,吉普"以及所有实例,吉普"的子类(仅返回相关
汽车"以及与之连接的所有关系的数据)?????????????????????
Assume that i have two classes "car","jeep" ..."jeep" is sub class of
"car" ,"jeep" has sub classes and instances like speed,color,made
in,."car" also have properties "vehicle","model"..... MY question is :if i ask
in code by jena about "car" the result be all properties of "car"
,"jeep" and all instances,sub classes of "jeep" (only return related
data of "car" and all relation that connect with it) ?????????????????????
推荐答案
没有.
最上一行的类Car
仅保存有关Car
的信息.第二行(扩展)类Jeep
保存有关Jeep
和Car
的信息.
您可以执行以下操作:
no.
The top row classCar
only holds information aboutCar
. The second row (extending)classJeep
holds information aboutJeep
andCar
.
What you can do is this:
Car oCar = new Jeep();
Car
的实例中包含对象Jeep
的位置.
您可以将其转换回扩展对象:
Where an object Jeep
is hold in a instance of Car
.
You can convert it back into the extending object:
if(oCar instanceof Jeep){
Jeep oJeep = (Jeep)oCar;
// ...
}
这篇关于通过耶拿检索相关数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!