I've just built a new OWL ontology in protege (classes, properties and individuals).
My problem is: How can I access (query) the individuals to use it in a program written in Java under Eclipse.
I've tried the following:
Generate the ontology java code and try to load it using Jena in
Eclipse but that requires programming using jena and Im not sure if
I need this.
Add protege plugin in Eclipse and try to access the OWL file to read
from the file but that also didn't work.
Thus what is the proper method for accessing (Querying) the OWL individuals from protege in a Java program written under Eclipse.
You should use a Java library for RDF. You mention Jena, but there's also Sesame. Or if you want something OWL specific, you could try the OWLAPI.
There's nothing fancy you need to do to use your ontology in an application. Any of the aforementioned libraries can read it in, it's just RDF after all, and provide programmatic access directly such as iterating over the triples, or via queries or other lookup mechanisms.
All three libraries have good documentation to get you started on how you'd read in and use your ontology. You might stick with the OWLAPI if you want to use a reasoner, or want to do OWL-specific manipulations of the data.
Related
The OWL API provides several IRI mappers to cache ontology documents locally. Do any of them use Oasis XML Catalogs, as Protege does? Even better, is there one to automatically cache read-in ontologies locally and check the original IRI for updates before using the local copy?
The Protege team have released the xmlcatalog component as a standalone (from the rest of Protege) module and it has an implementation of OWLOntologyIRIMapper:
https://github.com/protegeproject/xmlcatalog/blob/master/src/main/java/org/protege/xmlcatalog/owlapi/XMLCatalogIRIMapper.java
I just went through the source code, looking for implementations of OWLOntologyIRIMapper. As far as I can tell, none of the implementations save their mappings to disk, much less in the Oasis XML Catalog format.
I'd be very happy to find out I am wrong, so please let me know if I am!
Is anyone aware of a library that makes the process of creating XSDs in Java a little easier than using something like a DocumentBuilder? Something like a helper or utility class. I came across the org.eclipse.xsd maven jar but I'm having ClassNotFoundException issues when working with it in Eclipse and I'm not entirely sure it's meant to be used as a standalone kind of thing. This is a bit difficult to Google for as well since there are lot of search results around automatic generation/translation from Java to XSD and vice versa.
Essentially what I need to do is to programmatically create an XSD from a certain source of data -- not Java classes.
Apache XMLSchema is a lightweight Java object model that can be used to manipulate and generate XML schema representations. You can use it to read XML Schema (xsd) files into memory and analyze or modify them, or to create entirely new schemas from scratch.
The fact that with this API one can create an XSD from scratch, it sounds as a starting point to achieve the ask; as to the fitness, it depends on what that "certain source of data" is.
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 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
I have an ontology file (in RDF) which expresses the entities in the app that I am writing. I am using Jena, and can access the Concepts and create/access the resources by directly manipulating triples.
To make things easier, I created a set of Java classes, one for each type of resource in my ontology, keeping in mind their inheritances, and properties. E.g.
public class Agent{
}
and
public class Person extends Agent{
private String name;
}
If the ontology contains two types of resources, Agent and Person, with the latter being a subclass of the former.
I realized that the process of creating these classes (and the methods to extract them) are very monotonous. If I was writing an application on databases, I would have used a config file for Hibernate and let it take care of the details.
My question is: Is there a tool available that will take an ontology (in an RDF file) as input, and create a set of Java files representing the Concepts in the ontology, as in the example above? (or if Jena itself can do this, and I am missing something)
Thanks.
There are tools such as Bouml and Andromda with which you may generate Java from XMI UML serialization.
Furthermore, work has been done towards integrating UML with RDF: http://infolab.stanford.edu/~melnik/rdf/uml/.
So I guess you could find a way to transform your RDF to XMI then to generate Java from XMI, given you first map your initial RDF schema to RDF/UML.
Also I just found this paper: Automatic Mapping of OWL Ontologies into Java which I did not read so I cannot comment.
Protege supports RDF import and java export. I've used it in the past for getting ontology data into java programs and it's worked reasonably.
While going through the links provided above, I chanced upon the Trispresso Project, which provides a nice summary of the relevant tools and their features, including multiple inheritance and code generation. Thought it would make a good answer to my own question.
Did u checked JRDF? There are other code generation tools available too.. Check here.