owl:imports in Fuseki - owl

I'm new here, and although I've searched for something like this, I couldn't find an answer. So here is my question: How Fuseki handles owl:imports?
Details: I've defined a set of ontologies in different owl files. Let's call two of them of subDomainA.owl and subDomainB.owl.
To "join" these ontologies, I've defined a single owl file that imports the others. Let's call it completeDomain.owl, which owl:imports subDomainA.owl and subDomainB.owl. There are a few statements explicitly declared in completeDomain.owl. If it's not clear, It's something like sweetAll.owl in SWEET.
I need to import these owl files (with RDF/XML syntax) into TDB using Fuseki. How these imports will be handled? I mean, should I load the completeDomain.owl to the default graph and subDomainA.owl and subDomainB.owl to their respective graphs and Fuseki would "understand" imports and let me query all of them at once?
Using tdb:unionDefaultGraph is the same thing? What would happen with the statements declared in completeDomain.owl that uses entities declared in the subDomain ontologies? Also, I couldn't see the difference of tdb:unionDefaultGraph and Union Model.
As you can see, I'm a little bit confused and any help will be appreciated!

Following the tips from Joshua bellow(thanks for them, by the way), here is the answer:
To organize owl:imports into Fuseki, there are 3 options:
1) Import all ontologies files to the default graph.
2) Configure the store using tdb:unionDefaultGraph with true value, and import each file to its own named graph. This way, Fuseki will answer a query to the default graph with the union of all named graphs. Also, each graph can be acessed by its named graph and/or SPARQL GRAPH.
3) A Union Model combines in a single graph other graphs. Any app would not be able to query the graphs separatedely.
The original answer to this question is here!

Related

issues with min one in Protege

I have a homework to do for my studies that requires to use Protégé.
I am pretty new with the language OWL and with this software.
We need to create an ontology on hiking trails.
I have multiple classes like Hikers, Trails, Restaurants, Hotels, Equipements, and Places.
This last class (Places) has 2 subclasses: StartEndPoint and PicnicArea.
The class StartEndPoint correspond to the places where a trails start and end. So for my Trails class I have the axiome: (startingPoint exactly 1 Places) and (endingPoint exactly 1 Places) to symbolise that a trail starts and end at exactly one starting and ending point.
Similarly, i would like to create the axiom: each starting and ending place has at least one restaurant near this point.
To do so, i have added the axiom: "eatingPlace min 1 Restaurants" in the class StartEndPoint.
But when I run the reasoner, it says no error. I did create some instances from all classes but for the instances from the class StartEndPoint, it should say that there is no restaurant as I didn't add any property "eatingPlace" to those instances (see screenshots below).
I wanted to try if the minimum one were working well and so it should have returned me an error i guess. But I got nothing.
Is it normal ? If yes why ?
And if no, how could I resolve this ?
thanks a lot for your help
The reasoner is not finding any errors because of the Open World Assumption. You are stating that each endpoint has at least one restaurant near it, but this does not place any obligation on the ontology to list which restaurant is near to your endpoints - i.e., if you ask the reasoner if there is a restaurant near endpoint X, the reasoner will say yes; but, if you ask it to list the restaurants near endpoint X, the list might be empty because the information is not included in the ontology. This is expected behaviour for OWL ontologies.

How to import specific classes and object properties from an ontology in Protege?

I want to import some classes in Protege from different ontologies to my ontology. For example, I need the classes foaf:Person, org:Site, vcard:Organization, and many more.
I don't want to create them by myself (and modifying their IRI). When I did import the whole ontology (Schema.org, vCard, FOAF, …), I had many elements that I don't need.
Is there any way to do it?
— Have you looked at this thread: protege-project.136.n4.nabble.com/…
— I tried to use it, but it didn't work.
There are subtle moments, especially on step 5.
Open your target ontology.
Open the source ontology in the same window.
Select Refactor > Copy/move/delete axioms:
Select axiom selection method.
Select signature (i. e. a set set of classes, properties etc.) to import. Do not forget to press >> !
Now you can preview axioms to be imported.
Select what you want to do:
8-9. Select your target ontology:
Voila!

Loading different files using OWL API

I am using OWL API to load different files and merge into one for reasoning. I have one file describing the ontology and several files with individuals. Every individual has foaf properties, e.g., foaf:title, when I print the axioms it shows
'AnnotationAssertion(http://xmlns.com/foaf/0.1/title...'
and reasoning does not work. If I add
<'owl:DatatypeProperty rdf:about="http://xmlns.com/foaf/0.1/title'/>
into the individual file than title loads as
'DataPropertyAssertion(http://xmlns.com/foaf/0.1/title...' and reasoning works.
In the FOAF ontology is says that it is a data property, but loading it did not work either. I am using OWLOntologyMerger to merge the ontologies.
And I cannot add that into every file. Is there a way to do it programmatically or any way?
Thanks.
Use owl:imports from each file to import the base ontology, or foaf.
The problem here is that the owl api needs the declaration to be available either in the file or in the imported ontologies. It is not possible to parse rdf/XML unambiguously otherwise.

Multiple phrases per language in cakephp

I am creating a website using CakePHP that requires translation not only into multiple languages but also multiple phrases per language depending on the type of the logged in user. This will allow the same functionality but with more formal or more friendly language without duplication.
As a very simple example:
Type 1: "Customer", "purchase","shopping cart"
Type 2: "Client", "buy", "basket"
Type 3: "User", "order","invoice"
Each of these types would be available in multiple languages.
I've got the standard localization working in CakePHP (one of the reasons I chose it!) and have the appropriate default.po files in the /Locale/[lang]/LC_MESSAGES/ directory and all is working fine there (thank you to the user who noted on this site that ger needed to be deu to work ;) ).
Before I get too far into the app I'd like to add the phrasing so I can set e.g. the language as French and phrasing as type2. If I was doing this outside of a framework I'd have a matrix look-up to find the correct string based on language and phrase keys but am unsure of how to do this within CakePHP's localization.
Currently I'm using the standard __([string]) convention but as this is early in the development cycle it would be trivial to change if necessary.
I was considering using __d([phrase],[string]) but can't see how to set this without creating my app as a plugin and then I'm back to the same problem with /Locale/
I have been unable to find any example of this in my searches on SO or the cakePHP community sites so would be grateful for any suggestions.
Is there a standard way to do this within cakePHP? if not, what would be a good "best practice" way to implement this?
Edit - following the answer below here's how it was implemented:
in /app/Locale/[lang]/LC_MESSAGES/ I created a new .po files with the new phrasing in them as phrase1.po, phrase2.po etc.
Where I set the language I also set the phrasing where the phrase file matches the name of the po file:
Configure::write('Config.language', 'deu');
Configure::write('App.langDomain', 'phrase1');
and all strings were wrapped with:
__d(Configure::read('App.langDomain', 'string')
And it just works.
Use __d() like this:
__d(Configure::read('App.langDomain'), 'Some string');
In bootstrap.php check the conditions and set App.langDomain based on whatever you need.
__d() has nothing to do with plugins, you can use it everywhere.
And alternative would be to wrap your translations with a custom method, something like
__dd(Configure::read('App.langDomain'), array('foo' => __('String1', 'bar' => __('String2'));
The array is an array of langDomain => stringForThatDomain mappings. Your __dd() method would take the one that is passed in the first argument.

dynamic map managment in google earth

My goal is to display various shapes(polygons, points, linestring) on google maps by using data entered into a Postgis database dynamically(i mean by that we can see modifications in the map in real time).
I was looking for a way to do this that used the spatial structure already provided in postgis(already designating if shape is a linestring or polygon, etc) instead of parsing out the coordinates and then re-entering spatial structure in google maps. I saw that google maps api is now compatible with kml data formats. And then I read that i have to convert postgis data to kml format.
I've done some reading in the forums about the actual process of converting postgis data to kml via FWTools, but didn't see anything that would help me. I'm new to kml but am familiar with postgis and perl and PHP. Is there a tutorial for the process of converting postgis data to kml? Where can I get started? Thanks for any help
You can use PostGIS to convert to KML directly:
SELECT ST_AsKML(geometry) from MyTable;
ST_AsKML is one of several output formats, including WKT, GML, GeoJSON, etc.
To show dynamic data in Google Earth, a common pattern is to use KML with a NetworkLink element. Have the link's viewRefreshMode equal to onStop and Google Earth will make requests (to a URL served by PHP, presumably) with bounding box parameters attached. Use the bounding box to query features in the PostGIS database, and return results as kml. This is great if you have lots and lots of features, but only want to retrieve those in the region the user is looking at.
Depending on the complexity of your application, you may also want to look at GeoDjango. (Familiarity with PostGIS is a big head start!)
You can get a textual representation of the spatial data from a Postgres DB using a text conversion function, like
SELECT AsText(MyGemoetry) from MyTable
then you parse the string, create your objects using various API functions - depending on the PostGIS geometry type - and append these object to the main GE plugin object in a DOM like way.
If you are familiar with JavaScript and have a fundamental knowledge of XML, a good start is http://code.google.com/apis/earth/documentation/reference/
Don't forget to specify unique ID's to your objects so you can find them later to drop/modify.
Maybe you can get some inspirations here, display the linked "locator.js" file and look at function PaintSubField(Coord) ... this is another way, bit crude but effective, avoiding to mess around with too many individual parent/child objects and structures
You also may want to consult sample applications and use the code playground for "rapid prototyping"
re "realtime" you need at least an event that you can link your generation/redraw routines to.
Good luck
MikeD

Resources