I am trying to build a web site build on semantic technologies. It is a CMS, to make it simple lets say it's a blog. I need to be able to do simple CRUD operations. All data will be saved on Jena like blog posts, user informations, blog categories etc.
I have a php system. Here is the path what i am planing to follow:
Use Apache Jena as RDF Store
Use Apache Jena for storing and retrieving the data.
Write a web service on java
Communicate through web service with PHP in JSON format to view, control the data.
My main focus is to build a web site on semantic technologies.
Is there anything wrong with my approach?
If not the main question is when a user made a blog post how will i create a relation with the blog post and user.
With mysql it was just a froeign key. How can i make a relations on Jena between new blog post and existing user?
I can't see anything wrong with your approach. Maybe I would suggest to use JSON-LD as an interchange format, because Jena can read it and write it directly instead of having to create your own converters to RDF (see https://jena.apache.org/documentation/io/).
Regarding the modeling question, I strongly recommend to have a look at the SIOC vocabulary (http://rdfs.org/sioc/spec/), which aims to represent exactly what you are looking for, and more.
Another hardcore solution would be to create the pages of the website in RDF (serialized in RDF/XML), and use XSL to generate the HTML version on demand for each page. It really depends on the size of your website.
Related
I want to store the temperatures for a year from a weather forecast web site like this one into a database to can use it later in an android application. I tried to use Jsoup, but i only get pieces of the table containing temperatures.
Is there any way to get that html table content to can store it?
It would be a whole lot better if you used the API provided by wunderground instead of using jsoup in order to screen scrape the page.
The main reasons are that the implementation will be a lot cleaner and also your implementation will be immune to stylistic changes in wunderground web pages.
Here is guide on how to consume a REST web service with Spring.
Once you have retrieved the data from the API you could easily store the data in a database using an ORM framework like Hibernate since you would have already created the objects to retrieve the data.
You can make your life even easier if you use Spring with Hibernate integration to save the data. Check out this guide.
The guides mentioned above use Spring Boot to make it extremely easy to get started with the Spring framework (gone are the days where it would be almost impossible for a novice to get started with a Spring project all alone)
Broadly speaking, the HTML document displayed on the website would have to be parsed programmatically, tokenized, converted to suitable data types and finally stored into the database. However it should be checked whether the data on the website could be read via a SOAP webservice or something similar, as the interface would be cleaner and the approach more robust.
I'm developing an application where I've requested data from an external institution's website. They have informed me that the data will be provided by OAI-PMH.
Could someone show me some sample code in Java how data is extracted from a OAI-PMH ?
I wonder how different it is from reading and parsing XML data.
Thank you.
Warmest wishes,
Shoubhik
For a Java implementation, for example, you could use some already existent library, like XOAI with an easy to use API. There are some provided samples.
To extract metadata from each Record you could use a XML Parser or a XML bind approach (JAXB). For other languages, like PHP and Perl there are also other alternatives.
I want to try and integrate my rdf data which is in an .rdf file format with dbpedia so I can build make semantic knowledge of my rdf data. Does anyone know how I would go about doing this within Jena and Java
I believe that Jena support the SPARQL 1.1 SERVICE keyword, that lets you query across a local RDF store, and DBpedia at the same time.
There's a very brief example given here: http://www.w3.org/TR/sparql11-overview/#sparql11-federated-query
You might want to have a look at Freebase, which is a system dedicated to linking semantic data. See http://www.freebase.com/ for more info.
I'm finding my way around Android and so far so good. My next big challenge is coming to grips with web services. I would like to build an app that reads data from a web site or database on web server and store the data in my app.
Basically, it will be an app that I build in conjunction with a news website that pulls their latest articles into the app. What I'm finding difficult is how to bridge the gap between my application and the data in the SQL Server database.
I'm familiar with building asp websites that read data from a database, but how would I do something similar with an app?
Do I ask the website to store the articles in an xml format? Or, is there another way that I can request a specific article and be provided with the content?
I hope I'm phrasing the question correctly and that someone can just guide me to the right way to approach this.
Thanks in advance.
You can approach this problem from different perspectives.
The common solution is to build a Webservice that will bridge the gap between your mobile application and the data that remain in your server. I personnaly prefer to setup a Rails backend and thus have a RESTful API that will help me access my data. For instance, to retrieve the list of articles I could just request the following url: http://my_server_host/articles. So for the Webservice part you can have whatever you want: Rails, J2EE, .NET etc. And you can choose the model that fits your needs (REST, SOAP, XML-RPC etc.).
Then you will have to write a class that will contain all the necessary calls to the Webservice you have built. Basically, if your Webservice returns the results as an XML format you will have to:
Send the request to the appropriate URL. (See: HttpGet or HttpPost if you want to modify a resource).
Parse the XML returned. (In short, you can use SAX or DOM to parse your XML response and transform them to a business entity (an Article, a User etc.).)
This hopefully gives you a hint about a possible solution. By the way Google is your friend, but I will probably come back to add external links/resources to help you more.
Edit
Another possible solution that could work for you, since all you need is to retrieve some articles. Just setup a simple Wordpress blog for instance. Wordpress gives you an URL for the blog's RSS feed, all you will have to do is to parse that RSS feed (XML). There is a great article on the IBM website for parsing an RSS feed that you can find here. By the way, this solution is only possible if you want to save your articles on a Wordpress blog. But you got the point hopefully.
Reading your data form the Database on the Server would be bad practice. You'd have to open up some ports and that's defiantly not what you want (if you don't have root-access, you also can't).
For non-interactive content (what you want) you would use XML or JSON.
I have created an ontology. Now I want to create an application but how can I perform CRUD operations in owl file. I came across different apis like Dotnetrdf, jena etc all support RDF/RDFS but there is not support for owl file
http://www.semanticoverflow.com/questions/2704/using-jena-to-query-owl-files
Problem of reading OWL/XML
Also, most of apis are available in Java and I dont know how to write simple hello world program in java. I am confused with servlet, jsp and .java and lots of configuration is required. So I prefer php.
So is there any api or any alternative way to query owl file in php ?
Regards,
anas anjaria
The only libraries I know that support SW standards in PHP are rdfapi [1] and redland php binding [2], but the level is RDF (i.e. the building block of RDFS and OWL) you will need to add CRUD operations at the triple level (i.e. simple axioms like foaf:knows )
[1] http://www4.wiwiss.fu-berlin.de/bizer/rdfapi/
[2] http://librdf.org/docs/php.html
So, it looks like you're talking about the Web Ontology Language, an XML/RDF dialect.
A few moments in Google shows pretty much zero interest in this in the world of PHP.
But, being XML, you can use one of the PHP XML extensions so read and work with the XML directly without a problem. How well this will actually work for you, I can't say. OWL looks freakishly complex, and working with it at the DOM node level will very likely stretch your sanity far worse than working with mature, established libraries in Java.
i made my final project at the university by using Jena. The Research Group where i work develop ontology generator tool which is capable of all crud operations. They also developed the Eclipse plug-in of this project.
You just create your OWL Data Model in the editor and right click the data model create everything, i creates owl files, Crud class and it's test codes for you.
Let's check it out
Download
Name of Plug-in is "SEAGENT Ontology Generator Plugin (Beta)"
I hope it will be beneficial for you like me