How to add instances in ontology from CSV file - ontology

I tried to add instances in ontology using WebProtege. But the problem is that data is not assigned as data/object property instead it is in the 'type' the heading under the 'Description'. Is there any other quick way to add indvisuals from CSV file.

Steps:
Using Jena to read the ontology into Model X
Write small java code that will read each row of CSV file and convert it according the ontology vocabulary in the form of RDF statement.
RDF Statements can then be stored into the same Model X.
So at the end you will have both your ontology and data instances in the same model X. Then print your model X into some file with extension of saved file as "RDF/XML".

If using the Protégé Ontology editor environment you can use the plugin called "Cellfie" A Protégé Desktop plugin for mapping spreadsheets to OWL ontologies. The plugin is available in the menu item "Tools > Create axioms from Excel workbook..."

Related

default ontologies loaded into Graphdb

I am interested in finding out what are the ontologies preloaded into Graphdb by default. This will help me identify what ontologies (.ttl files) do I need to add along with my ontology as part of the package, especially in the situations when there is no Internet connection.
I know that some ontologies such as rdfs and owl are preloaded into GraphDb. but I could not find any list on preloaded ontologies.
Please keep in mind that OWL does not differentiate very clearly ontology from instance triples. Also GraphDB introduces another term "axiomatic triple" (i.e. statement that cannot be deleted with a normal user transaction) used to separate the ontology statements from the normal RDF.
There are 3 ways of loading ontologies as axiomatic triples in GraphDB:
Ruleset - will import all statements from the beginning of a PIE file as axiomatic statements. Check here for additional information.
Add imports initialisation parameter - this will safe a configuration predicate in the SYSTEM's repository See the configuration parameter
Add a special predicate in the beginning of an RDF file - the system transaction will add all following statements as ontology. Check here.
Another approach is to add every file in a different named graph. This will allow you to see which graphs are currently stored in the repository.

Is it possible to add individual from CSV file into ontology in rapidminer?

I made an ontology and add instances or individuals manually,however if I want to add the data from CSV file into ontology, Is it possible in rapid miner?I know how to load CSV file in rapid miner.But how to add data in ontology using rapid miner?

Reusing Dublin Core Ontology

I'm new in ontology and i'm using protege to create my own. I have imported the Dublin core ontology (http://purl.org/dc/elements/1.1) into my own ontology using protege but only annotations were included. Upon reading the documentation of Dublin core there were classes and properties defined. how will i include these classes and properties in my ontology with the use of protege?
I think your problem is that you don't look inside the files. Dublin Core has many files. The one that you are referring to (elements) only contains annotations. You need to find the appropriate file. The DC terms contains some properties and classes. You need to read the documentation and then import the file with the modelling elements that you require.

Use CSV to populate Neo4j

I am very new for Neo4j. I am a learner of this graph database. I need to load a csv file into Neo4j database. I am trying from 2 days,I couldn't able to find good information of reading the csv file in to Neo4j. Please suggest me wil sample code or blogs of reading csv file into Neo4j.
Example:
Suppose if i have a csv file in This way how can we read it into Neo4j
id name language
1 Victor Richards West Frisian
2 Virginia Shaw Korean
3 Lois Simpson Belarusian
4 Randy Bishop Hiri Motu
5 Lori Mendoza Tok Pisin
You may want to try https://github.com/sroycode/neo4j-import
This populates data directly from a pair of CSV files ( entries must be COMMA separated )
To build: (you need maven)
sh build.sh
The nodes file has a mandatory field id and any other fields you like
NODES.txt
id,name,language
1,Victor Richards,West Frisian
2,Virginia Shaw,Korean
3,Lois Simpson,Belarusian
The relationships file has 3 mandatory fields from,to,type. Assuming you have a field age ( long integer), and info, the relations file will look like
RELNS.txt
from,to,type,age#long,info
1,2,KNOWS,10,known each other from school
1,3,CLUBMATES,5,member of country club
Running:
sh run.sh graph.db NODES.txt RELNS.txt
will create graph.db in the current folder which you can copy to the neo4j data folder.
Note:
If you are using neo4j later than 1.6.* , please add this line in conf/neo4j.properties
allow_store_upgrade = true
Have fun.
Please take a look at https://github.com/jexp/batch-import
Can be used as starting point
There is nothing available to generically load CSV data into Neo4j because the source and destination data structures are different: CSV data is tabular whereas Neo4j holds graph data.
In order to achieve such an import, you will need to add a separate step to translate your tabular data into some form of graph (e.g. a tree) before it can be loaded into Neo4j. Taking the tree structure further as an example, the page below shows how XML data can be converted into Cypher which may then be directly executed against a Neo4j instance.
http://geoff.nigelsmall.net/xml2graph/
Please feel free to use this tool if it helps (bear in mind it can only deal with small files) but this will of course require you to convert your CSV to XML first.
Cheers
Nigel
there is probably no known CSV importer for neo4j, you must import it yourself:
i usually do it myself via gremlin's g.loadGraphML(); function.
http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html#rest-api-load-a-sample-graph
i parse my data with some external script into the xml syntax and load the particular xml file. you can view the syntax here:
https://raw.github.com/tinkerpop/gremlin/master/data/graph-example-1.xml
parsing an 100mb file takes few minutes.
in your case what you need to do is a simple bipartite graph with vertices consisting of users and languages, and edges of "speaks". if you know some programming, then create user nodes with parameters id, name | unique language nodes with parameters name | relationships where you need to connect each user with the particular language. note that users can be duplicite whereas languages can't.
I believe your question is too generic. What does your csv file contain? Logical meaning of the contents of a csv file can vary very much. An example of two columns with IDs, which would represent entities connected to each other.
3921 584
831 9891
3841 92
...
In this case you could either write a BatchInserter code snippet which would import it faster, see http://docs.neo4j.org/chunked/milestone/batchinsert.html.
Or you could import using regular GraphDatabaseService with transaction sizes of a couple of thousands inserts for performance. See how to setup and use the graph db at http://docs.neo4j.org/chunked/milestone/tutorials-java-embedded.html.

populate an existing ontology from a csv file using Jena

How to read an ontology (owl file) using jena and populate this ontology (ontModel) from a CSV file then write the populated OntModel into OWL file
There are three parts to your question:
reading an OWL file into a Jena Model
converting a CSV file into RDF
writing the contents of a Jena Model out to a file
The first and third of these are easy with Jena (see Model.read() and Model.write() methods, and the FileManager for some additional convenience support for reading from different locations).
The second part is the tricky one. Typically, when converting a CSV file to RDF, we assume that each row represents one RDF resource and its properties. You have three tasks to achieve:
Determining the URI that represents the resource, based on some key in the row of data
Determining the URI of the RDF property that represents the value of a given column
Mapping each column value to an appropriate resource URI or literal value.
For example, consider the following CSV:
id,name,age,occupation
2718,fred,107,ninja
We can use the first row of the CSV to suggest RDF predicate names. foaf:name and foaf:age would be appropriate choices for the first two columns, but we may need a new predicate in our namespace for the third column http://example.com/vocab#occupation. The resource URI will be based on whatever the key is for the data, in this case the id column, suggesting that the URI for the resource denoted by the first row will be http://example.com/data/employee/2718. Finally we have to map the data. The name is just a string, the age is an integer and the occupation is a resource. Given those choices, we may end up with output like:
<http://example.org/data/employee/2718>
a foaf:Person;
foaf:name "fred";
foaf:age "107"^^xsd:integer;
example_com:occupation <http://dbpedia.org/resource/Ninja>.
The W3C working draft R2RML defines a standardised mapping language for performing these kinds of translations. Various implementations of R2RML are available. Of course, if your mapping is fairly stable it would be perfectly straightforward just to write some code to perform the translation from CSV for your particular input data.

Resources