Insert mysql records into OWL ontology as individuals - sparql

I created an ontology using Protege and it saves as .OWL file in RDF/XML serialization.
My ontology has two main Classes.. Category and Review.
I have defined the object property called isAbout which connect the category individuals and review individuals.
I have created some named individuals under both classes. Then I load my ontology using java jena and query some data using SPARQL.
So far so good..
I have some review data in a MySQL table which I want to map with my ontology and query those results as well.
My database table with sample record.
------------------------------------
| Review | Rating | Category |
------------------------------------
| "Great one" | 5 | "Display" |
------------------------------------
I want to convert this data into RDF and insert those records as Review individuals into ontology. There will be an category individual which maps with Category value in the database table. So I want to link this newly created individuals using isAbout object property as well.
So how can I do this?
Ps: As a concept I want to integrate distributed data sources into a common platform. Am I on the track or doing something wrong or is there a better way to do this?
---- Update 2018/04/13 ----
I made a progress with D2RQ tool. Which allows me to map the Database tables and columns to ontology and generate RDF. Now the data in my table is represented as follow in a separate RDF.
<rdf:Description rdf:about="reviews/3">
<vocab:reviews_Category>OLED</vocab:reviews_Category>
<vocab:reviews_Rating rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">3</vocab:reviews_Rating>
<vocab:reviews_Review>wow</vocab:reviews_Review>
<vocab:reviews_ID rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">3</vocab:reviews_ID>
<rdfs:label>reviews #3</rdfs:label>
<rdf:type rdf:resource="vocab/reviews"/>
And a sample individual in my ontology looks like
<reviews_2:Review rdf:about="http://review-analyzer.local/ontologies/reviews_2.owl#tt2">
<reviews_2:isAbout rdf:resource="http://review-analyzer.local/ontologies/reviews_2.owl#amoled"/>
<reviews_2:comment>dfgh</reviews_2:comment>
<reviews_2:rating rdf:datatype="http://www.w3.org/2001/XMLSchema#integer"
>2</reviews_2:rating>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
Now the question is down to how do I combine these two RDFs to get data from SPARQL? can I do this using SWRL(Semantic Web Rule Language) ?

Related

Database design for a product-configurator

I have been asked by a customer to develop a "product configurator", and i need some inputs on how to handle the DB part of the project.
Each product can have a subset of different precreated attributes.
The minimum is 1 attribute, but there is no maximum.
Some attributes have dependencies/relationships with other attributes.
Eg. If the product is a chair, you need to choose the material (wood, plastic, metal), and you need to choose which type of legs the chair shoud have.
If the Product is a cabinet, you still need to choose a material, but instead of legs there will be different doors to choose from etc.
Each of these attributes might have subattributes. Eg. the door has a color, a size and a doorhandle.
Then the door handle has a material, a type and so on.
This ultimatly ends up in a multi-layered attribute-tree.
By itself this isnt too complicated to code, however the customer wants to be able to manage (Create, update and delete) all products, attributes and relationships between attributes, within the webapp.
So coding the relationship-part isn't a viable solution.
I have gone with a EAV model to facilitate the "potential unlimited" amount of attributes each product can have.
But i am struggling to figure out how to go about the "attribute relationships".
A simplified version of my DB design looks like this:
If each product could subscribe to groups of attributes that is legal. Then each attribute belongs to a group like "wood group".
Then the user could set the groups of attributes against a product that should need to be answered to configure a product.
With regards managing a tree, you could use a column type of hierarchyid . Or construct an outline string as key field.
An outline for example
1.
1.1.
1.1.1.
1.2.
2.
2.1.

What could be a good piece of SPARQL Code on DBPedia to Extract Agricultural Data?

I am trying create triplet dataset on Agriculture. I am new to SPARQL . I am trying build a query so that
I can fetch pest name, attacked corps and geo location of it's existence.
Corps name, region name where it grows and required weather
Etc.
Can anyone help me with the query or any resource from where I can learn to build them.

How can I pull and concactenate a Wikipedia table with individual article data

I'm looking to pull together a full list of the current FTSE 100 constituents with the addition of a column highlighting when the company was founded.
Each wiki info box for the individual companies within a table contains the founder date. I'm struggling to work out the function in sparql utilising dbpedia to take the existing ftse 100 table.

Do I need a database for this application?

I have a very large amount of data that would most naturally be represented as a tree:
Category 1
Sub-category 1
data point 1
attribute 1
Sub-cateogry 2
data point 1
attribute 1
attribute 2
data point 2
Category 2
Sub-category 1
Sub-category 1
data point 1
Sub-category 2
data point 1
data point 2
Sub-category 2
data point 1
data point 2
data point 3
...
The individual data points have text and numerical attributes, bit it doesn't really suited for representation as a set of related tables. I would like to be able to perform SQL-like queries, but I would also like to be able to browse through the data in a way that makes the tree structure of the data obvious, like with a file manager.
There's probably some class of application that is ideal for such a thing, but it isn't occurring to me at the moment. Some kind of combination of a database and a tree viewer control? Anyone know what it is I'm looking for? As always, I'm terrified of asking a question in the wrong forum, but I see some related questions here at stackoverflow, so hopefully it's OK. Thanks!
You could make a table like this
id
name
parent_id
This structure would allow for nested categories
You could then make a table that relates category and data points.
The java.swing packages contain several table and tree solutions such as the JTable and JTree classes. JTree can be easily constructed to produce the tree structure you are looking for (looks like a file directory.)
The JTable class can be used to create sortable and searchable tables, although you would have to borrow or write your own sort & search methods.
Although these are from Java, other languages offer similar structures that may serve your needs without using a database. That being said, "mySQL" is a very easy to use database and you can download the community DB package for free.

Relational Entity with one Model Class

I am facing Problem with Entity Framework with MVC 4 .
Let me put the Table Structure and result which i needed.
as you can see i have three table and the data structure is
can anyone suggest me how can i write Model class so that on create country page i have layout like
select Language -- Language Dropdownlist Box here
Enter Country name- country text Box here
Thanks
Ashutosh
As already said, you have problems with your table structure, and a model will reflect this, not correct it. And while I am at it, German and Chinese are languages, while Germany and China are countries.
Country Names should be in Countries table, while country_languages is a table allowing a many to many relationship and as such should never be seen by your end user.
If you define your model properly with only Countries and Languages, Entity Framework with Code First will generate a correct Countries_Languages table for you.
Don't forget that in some countries, more than one language is spoken, like Switzerland which has 4 official languages....