Starting to Develop on OpenHab-Core and I have a couple of questions to ask

Dear OpenHab Community,

I am a student at DHBW Mannheim. I am currently doing my bachelor thesis. The topic is about using Protege’s Reasoner (Ontology) to reason and output what states have been changed on the items. TO make it simpler I have my items configured on Openhab and the sitemaps, etc. but the only thing that I don’t want to do on openhab is to write my rules using the Xtend Engine or JS223 or any other openhab engine. in fact, I am trying to implement openhab’s items settings to an ontology of classes on protege and implement my rules using semantic programming languages like SWRL or PROLOG. so I want to clearly detect a change in an item send it protege interface and then protege reasons it and returns with the final state of each item and update the states on openhab. Now, this is my goal I want to achieve. But I have trouble starting to develop on openhab. I have a couple of question.

Q1: What are the required knowledge and technologies needed in order to achieve such a goal knowing I am not an experienced developer so far I have little knowledge about developing??
Q2: I tried cloning openhab-core from the repository and I ran mvn clean install and it built successfully and then I imported the whole project as maven project to eclipse but I have no idea how to run it and test it. what I have in my mind is that I change or develop something on the core and from openhab-core’s project I will run it and I will access the openhab-core using the localhost:8080. I don’t know if this is correct.

I know I am aking a lot of questions and I know I am not well prepared to start doing this but I hope some advice from the community would help me start on the road.

Thank you So much

Why does this have to be embedded into OH in the first place? Why not set up a bridge between OH using MQTT or OH’s REST API and Protoge or the other languages you want to use?

OH is event based. Events get published on an Event Bus. You don’t necessarily need to be running within the same process as OH to subscribe to or publish your own events. This is how many users use external Rules engines like NodeRed.

Q1: Getting into OH core development is going to take a lot of learning about Java, OSGI, and scripting within Java. I’m not entirely certain that SWRL or PROLOG are supported languages that can be run on Java. Protoge should be runnable inside of OH since it’s written in Java, but you will need to be a pretty good Java developer to pull this off.

Given the time constraints I recommend keeping a hands off approach to OH and develop your own bridge between OH and your rules engine. Then you can package Protoge et al up how ever you already know how to do and you only have to deal with the well published OH REST API to subscribe to and publish for events. This will vastly reduce the amount of stuff you have to learn I think because you will just be bridging between two well defined APIs rather than trying to modify existing code.

1 Like

@rlkoshak Thank You so much for your reply. If it was up to me I would have used the rest API and get the job done. but I am asked to implement on top of OpenHab-Core. I already have a solid background of Java but what I lacked was the OSGi Concept along with its frameworks such as Karaf which uses either Apache Felix or Eclipse Equinox. But I still am a beginner. So for these reasons I wish if you can kindly. put me on the road of developing on OpenHab-Core. Currently, I pulled the OpenHab-Core only and I built it with maven and imported in eclipse. but I don’t see how to run it and see an actual interface where when I change something in openhab-core it gets affected on the interface. I am sorry if I seem a bit of an amateur but this is the first time for me on such project and I hope I can learn from it a lot and finish it. and sorry for the inconvenience.

Addition: Using the Rest API would let me send a request periodically and process it. it wouldn’t be simultaneous the way i want to do it is once an item change in the openhab-system it goes automatically to the Protege Bridge Built on the openhab-core and the protege bridge goes and use its reasoner and comes back with the new state of the items and then openhab update its item accordingly

I can’t. I’ve not so much as looked at a single class in the core. I’m not a developer on openHAB. I just know that trying to shoehorn this into openHAB is going to be far more challenging than some other approach.

There is a websocket you can subscribe to to get a stream of updates as they occur. That’s how the UIs are able to update in near real time as Items change state.

1 Like

Sounds like a job for MQTT event bus - which can be configured to publish every Item change via MQTT.

Getting into modifying openHAB core sounds unwise when you can develop something freestanding alongside instead.
It rather depends whether they want a genuine practical solution to a requirement, or its just a way of making you learn a particular development system.

1 Like

It would be nice if a moderator could flag all those double posts of this user.

I have answered this already in the developer thread.

To put it as polite as possible under this circumstances: Nobody here will write your thesis. Do it yourself.

Background for others: the user asked for the basically full solution also via PM.

Regarding the implementation: it would take me probably a weekend to do that. For your thesis: the way to archive the goal is already part of the work, that’s why you have a 4 month timeframe. Openhab is not doing something fancy, knowing a bit about OSGi, how to develop for it and reading the documentation is really not too much for a thesis!

1 Like

Dear @David_Graeff,

I clearly didn’t ask in any of my posts for someone to write my thesis. And I studied OSGi to a certain Extent. All I was asking is how to setup the OpenHab-Core and How to run it. Since it is not documented.
And I followed this doc to try and start the openhab-core but i ended up with errors. the Software isn’t well documented for developers on the Openhab-core. So your accusation aren’t valid. So please Instead of throwing Accusation Don’t Respond to my Post. and Thank you for help in the previous Posts.