comparing two OWLs to determine similarity - semantics

I have two OWL files each file describes what a receipt is, OWL-A has class named RecBody with property hasItem. OWL-B has the same class but has a property called hasField. both are identical
My question is how specify to the RDF engine that hasItem and hasField are the same "thing" I need a solution do this automatically since I face such problem when I try to bind data from heterogeneous sources

Well, you can use the owl:sameAs tag to do this, according to the Owl language reference.
Using this tag will make it clear to a reasoner that these two constructs refer to the same thing.
Sources: http://www.w3.org/TR/owl-ref/#equivalentProperty-def
http://www.w3.org/TR/owl-ref/#sameAs-def
For classes be sure to use owl:equivalentClass and not owl:sameAs as the latter if used on classes will make your ontology OWL-Full
Source : http://www.w3.org/TR/owl-ref/#equivalentClass-def

Related

Make an RDF file refer to other RDF files

I have two ontologies ontology1.owl and ontology2.owl where the first depends on the second (ontology1.owl imports ontology2.owl).
I have an RDF file instance1.rdf that conforms to ontology1. instance1.rdf refers to individuals from instance2.rdf which conforms to ontology2.owl.
I have an application that employs instance1.rdf to do some specific logic. However, data from instance2.rdf are also required for the processing as instance1.rdf refers to individuals from instance2.rdf. Let's assume that all instances and ontologies are available on the web. For example:
http://www.example.com/ontology1.owl
http://www.example.com/ontology2.owl
http://www.example.com/instance1.rdf
http://www.example.com/instance2.rdf
QUESTION
The entry for my application should be instance1.rdf which the user should provide (or provide a link to it). However, it's not the user's responsibility to know the required instance2.rdf, it's rather the application responsibility and this can be known by encoding such dependency in instance1.rdf. Is there any elegant way to make instance1.rdf refer to instance2.rdf, so that my application knows where to retrieve instance2.rdf from and load it? The
NOTES
I do not want to use owl:import. The reason is that both files instance1.rdf and instance2.rdf are RDF files, I do not want to use owl constructs here.
A possible workaround is that in instance1.rdf, I create a special property, e.g., dependsOn, and set the value of the property to the link to instance2.rdf, and handle the rest in my application. Is this straightforward?

Class diagram - multiple classes uses same class

I am designing a class diagram for an assignment. In this design, I use a separate class called Currency, to define currency values and their functionality. there are at least four other classes have to use this Currency class.
How can I show it in the class diagram ? I mean, do I need to draw relationships (connecting lines) from the Currency class to all the others ?
Is there a better way ?
What am I doing wrong here ?
There is nothing wrong and a reusability of a class is valuable. Actually that's a standard situation.
If you use this class in another class as an attribute you have two options to depict that:
draw an association relationship (line) from the class using to the class that is used.
put the attribute in a proper compartment of a class that is using and as a type of an attribute (after a colon) put the name of the used class.
The benefit of the first approach is that you immediately see the dependency between the classes.
If you use a class but not directly as an attribute type you use other relationship types that suit best to the situation you want to describe.
As I imagine one of your concerns is that you'll have a lot of relationships pointing to your class (in your case Currency). Don't worry about that. You don't have to put everything in a single diagram. Put a full specification of your class on one diagram with those relationships where it uses something else and then put only the class box with a name (without any compartment) on diagrams defining those elements that use your class. It will make your model readable. And with a support of some CASE tool you will be able to see all relationship and dependencies of this class anyway. By the way that's how the UML specification is written. Look for example how Namespace is used in the diagrams there (and many others as well).
Of course I'm not suggesting creating one diagram per one element to define it. No. Collect them in logical Packages (hey - that's exactly what Packages are for!) and make a class diagram per Package. If the Package becomes too large - you might need to split it into smaller subpackages.
For Currency your Package would be probably something like Utils. It can also contain other elements like Date, Address etc. Note - these are typical examples, probably every analyst/designer/programmer sooner or later has to cope with those elements. If you build them well, you'll be really able to reuse them in future applications as well.
One last thought. While you build "package based" Class diagram you might also need a diagram that shows just specific parts coming from several Packages to clarify some bit of your system/business/whatsoever. This is also absolutely fine. Again a benefit of CASE tool here is that it keeps consistency in your model.

Should enums be considered as models?

I'm in a state of a design dilemma wherein I'm unable to decide whether an enum should be considered as a part of models or not. The definition I have for models is that they represent knowledge.
With that logic, an enum should be a model. Moreover, I have seen in some codebases that enums are stored as tables in the DB so that the knowledge is stored in the DB itself and can be accessed later for joins, or from code.
What do you guys usually do? For example, if you have a file called models.py which contains models, will you store the enums in it? Or will you create a new file enums.py?
ok under the assumption that models can be understood as classes:
If I design the namespaces and class-structures of a project I usually safe enumerations in separate files like "CarTypes.class", "Color.class" and put it in the same namespaces as the classes which will access those.
But that depends on the accessibility I have to grant other classes towards those enumerations. If only one class uses a enumeration or structure I will not put it in a separate file and rather will define the enum/struct inside the file of that particular class. But if it should be accessible over multiple classes or namespaces I definitely go for the first approach.
Hope that helped a bit. ^^

Resoning on Terms if reused by refering to their URIs

I want to reuse existing vocabulary. Instead of importing whole ontologies, I want to do it by referring to URIs of selected classes and properties in my ontology.
If ontologies are imported then axioms are also imported in my ontology, so reasoner obviously will take care of the imported axioms.
But if I reuse classes/properties by referring to their URIs then axioms are not imported in my ontology. So, My question is that will the reasoner respect the rules applied on the referred terms?
====
Added Later
instead of copy past or OWL Import if terms are reused by referring to their URIs then axioms are not imported into target ontology.
But my question is that if internet is available then will the reasoner Fitch and respect axioms applied to that specific (reused) term.
for example, if I am reusing nfo:fileSize by referring to semanticdesktop.org/ontologies/2007/03/22/nfo/#fileSize , so if in case I am connected to internet then will reasoner go over internet to check for the axioms applied to nfo:filesSize?
The answer is no, reasoners are not expected to find out more axioms online if presented with the IRI of a class or property. They are meant to use all and only the axioms in the import closure of their ontology.
However, there are other ways of including only part of an ontology into a new ontology, for the purpose of reusing classes and properties with their original meaning. There are techniques such as modularisation and atomic decomposition that allow you to select a subset of the axioms of an ontology, e.g., all the axioms used in defining a specific class - which you can then copy over.

What is difference between XmlSchemaType/XmlQualifiedName classes

Can someone tell me the difference between XmlSchemaType and XmlQualifiedName class. I'm bit confused when to choose which class. Actually I'm using IXmlSerializable interface for my class and to specify schema for this I used XmlSchemaProviderAttribute and specify the function which can return either XmlSchemaType or XmlQualifiedName. Both work fine and I successfully generate the proxy. but unable to find a consolidated analysis which one is to use in which condition.
As per Microsoft
XmlSchemaType Class:
The base class for all simple types and complex types.
XmlQualifiedName Class:
Represents an XML qualified name.
but I'm unable to understand the exact difference between these two.
After doing google and reading some article I've finally find the difference between these 2 and understand where to choose what?
There are 3 different types that can implement IXmlSerializable Interface
Content types
Element types
Legacy DataSet types
For content types we need to use XmlQualifiedName Class as return parameter (Method name specify in XmlSchemaProvider) and this will require that main root element of XSD will be the complextype.
For elements types we need to use XmlSchemaType Class. Here you can specify any root element in XSD.
For Legacy DataSet types we don't use XmlSchemaProvider attribute. Instead, they rely on GetSchema method for Schema generation.
I've found all this useful information from following MSDN link. A must read article for better understanding how Xml Serialization works in WCF.
Using the XmlSerializer Class