I defined class RoadSegment
and datatype property hasRoadNumber
. So, now I want to define class Road
and state that a Road
is a set of RoadSegments
with the same road number. How it can be done?
Asked
Active
Viewed 113 times
1

Henriette Harmse
- 4,167
- 1
- 13
- 22

SVS
- 61
- 6
-
I. e. you want to generate new individuals like this: `:newRoad1 :hasSegment :segment1WithRoadNumberE95`? Try this way: https://stackoverflow.com/a/51817229/7879193. – Stanislav Kralin Sep 14 '19 at 23:05
-
Yes, I want to infer that these RoadSegments together create a Road. But I am afraid that that way of defining a Road is too computationally expensive. How do people usually deal with such situations? Do they create Road individuals explicitly? – SVS Sep 15 '19 at 07:24
-
Are you limited to OWL? If not, this is easier with SHACL. – Ivo Velitchkov Sep 15 '19 at 08:12
-
No, I am not limited, the question is which databases support all these needed tools. My goal is to create a system for analysing traffic on roads, so I thought I can infer different facts from basic roads state, for example speed limits, traffic lights states, vehicle speed at specific point. So basically there will be a lot of points and a lot of vehicles.. Does it make sense? – SVS Sep 15 '19 at 08:36
-
Also, there is a need to define sequences, since vehicle motion is a sequence of points, and "be before" that point is crucial... – SVS Sep 15 '19 at 09:21
-
Check [this](https://phd.pietercolpaert.be/) out. Might be of interest for your work. – Ivo Velitchkov Sep 15 '19 at 15:55
-
Thank you. It seems to me that this work loosely related to semantic tech and inference in OWL knowledge representation languages.. – SVS Sep 15 '19 at 19:54
1 Answers
0
Let's assume this data
<r123> a :Road; :number "123".
<r123.1> a :RoadSegment; :number "123"; :seq 1.
<r123.2> a :RoadSegment; :number "123"; :seq 2.
You can easily infer what you want with this GraphDB rule (.pie):
id: roadSegments
r <rdf:type> <Road>
rs <rdf:type> <RoadSegment>
r <number> n
rs <number> n
-------------
r <hasSegment> rs
The benefit is that the rule is dynamic, i.e. as you add/remove/edit segments, :hasSegment
will be updated dynamically.
As for sequences, there are various patterns to represent them.
rdf:List
is standard but quite unwieldy.- Using a sequence number makes things easier, eg https://schema.org/ItemList uses it (but unlike above, allows an item to be member of several lists, using auxiliary class https://schema.org/ListItem.

Vladimir Alexiev
- 2,477
- 1
- 20
- 31