MR3 Document¶
What is MR3 ?¶
MR3 (Meta-Model Management based on RDFs Revision Reflection) is an editing tool of RDF-based contents developed for managing a relationship between RDF (Resource Description Framework) and RDFS (RDF Schema) contents.
Introduction¶
The Semantic Web is one of the most promised candidates as the Web tomorrow, whose basis is on RDF and RDF Schema recommended by the World Wide Web Consortium. The purpose of the idea is to make the data on the Web available not only for displaying but also for automation, integration and reuse of data across various applications. At the moment, a number of supporting environment have been developed as the adopted tools of traditional knowledge engineering based ontologies. These products are mostly concentrating on creating ontologies and managing ontology-based semantic markup. From the standpoint of a significance of information lifecycle on the Semantic Web, in this work, an editing tool of RDF-based contents is developed for managing a relationship between RDF and RDFS contents.
Features¶
MR3 provides the three main functions to edit and to manage the several sorts of relationship among RDF and RDFS contents as follows.
- Graphical Editing of RDF Descriptions
- Based on the semantics of RDF data model, the tool supports to edit the resource-property-value relation.
- Graphical Editing of RDFS Descriptions
- Based on the semantics of RDF Schema model, the tool supports to edit the class-subclass relation and to add the information of properties such as range, domain, sub-property, and so on.
- Meta-Model Management Facilities
- In order to reflect the change of RDF or RDFS contents on the other, the tool supports the correspondence between them.
The above function consisted of the following sub-functions.
- Transformation of RDF resources into graphical representation of RDF data model, including the management of different RDF resources and mapping the additional information to RDFS.
- Transformation of RDF data graph into RDF resource, including name-space management.
- Transformation of RDFS resources into graphical representation of RDF data model, including the management of different RDFS resources and visualize the side effects to the corresponding RDF resource.
- Transformation of RDFS data graph into RDFS resource, including name-space management.
- Reflecting the change of RDF resources on the corresponding RDFS resources, not only editing RDF resources but also loading new resources.
- Reflecting the change of RDFS resources on the corresponding RDF resources, as the same time above.
Installation¶
Requirements¶
MR3 is implemented by Java language. JRE (Java Runtime Environment) 8 or later is required to execute.
We confirmed MR3 following environemnt.
- MS Windows 10 + JDK 1.8.0_40
- Mac OS 10.11.3 + JDK 1.8.0_40
How to Install¶
- Download the file from Download Page
- Execute MR3.exe or MR3.app in the extracted folder.
How to Uninstall¶
- Remove the extracted folder.
Used libraries¶
MR3 uses the following libraries:
Key concepts¶
Contents
Model and Ontology¶
In this section, we describe model and ontology in MR3 .
Model¶
Models are essential machine readable contents described by RDF and these are exclued trivial information from web contentns. Specifically, models include RDF triples and the subjects of the triples belong to one or more classes in RDFS. Models consist of elements provided by ontologies. The elements are types of resources and RDF properties. In the Semantic Web, the model is equivalent to RDF content (facts in OWL).
Ontology¶
Ontologies are classes, properties, and relationships between classes or properties. In the Semantic Web, ontologies are equivalent to RDFS or OWL contents. Types of resources are defined by RDFS classes and RDF properties are defined by RDFS properties. Relationships among Web resources, models, and ontologies are shown in Fig. 1.
RDF data models are built from Web resources. RDF data models are described by RDF/XML format as RDF contents. Domain ontologies or general ontologies (WordNet [Miller95], EDR [Yokoi95], etc) are used to build RDF data models. Same domain ontologies can be used when multiple web resources belong to same domain. For example, two RDF models that belong to Domain B use an RDFS domain ontology in Fig. 1 .
Concept of Meta-Model Management¶
This section discusses our concept of a meta-model and meta-model management. In our research, meta-model is defined as a model expressing the components of models, especially the type of an RDF resource and RDF property. RDFS class is a model expressing the type of RDF resource. RDFS property is a model expressing an RDF property.
Since RDF and RDFS descriptions are described with the same RDF syntax, there is no clear distinction between RDF and RDFS parts. This forces us to observe the type of resources in order to pick up only an RDF part or only an RDFS part. Although the recent trend of Semantic Web languages, including Web Ontology Language (OWL), tries to capture the advanced concept of ontologies in a single framework, there is no clear support to manage the correspondence between RDF and RDFS.
Since RDF and RDFS can be regarded as the relationship between a model and a meta-model, in the concept of meta-model management, RDF and RDFS can be managed separately and maintain their relationship automatically. In some of the logical frameworks described above, the meta-model concept seems to capture the above RDF and RDFS relationship. Such a logical framework reminds us to distinguish RDF and RDFS clearly, and can be expected to bring (semi-)automated support of the consistency between RDF and RDFS.
As a key concept in our research, we focus on the meta-model management, which is defined as the appropriate management of the correspondence between a model and its meta-model: especially, the management of the RDFS class and RDFS property in a meta-model, and the type of an RDF resource and RDF property in a model. Fig. 2 sketches the concept of meta-model management.
Meta-Model Management Scenarios¶
From our experience, we consider that the actual construction of meta-models and models in RDFS/OWL are performed from two different views. Meta-models are constructed considering a conceptualization which is separated from a real object world. On the other hand, models are constructed considering a real object world. Some modifications in models will cause the modifications of the meta-models, and vice versa. Moreover, in order to construct appropriate meta-models and models, modelers need to modify models and meta-models repeatedly. In such situation, since the modifications are made so often in both models and meta-models, these refinement costs are quite expensive. The graphical editing functions of MR3 will help modelers manage the model and the meta-model from a panoramic view. The meta-model management facilities will help modelers concentrate on editing and evaluating models or meta-models without frequently switching the editing modes between a model and a meta-model. The aim of our research is to provide such functions and facilities that will reduce the refinement cost of models and meta-models by the reflective processes.
Fig. 3 shows an example of meta-model management process. The upper part of Fig. 3 shows a meta-model modification process. The lower part of Fig. 3 shows a model modification process. C1, C2, and C3 in the meta-model depict RDFS classes. P1 in the meta-model depicts an RDFS property. R1 and R2 in the model depict RDF resources. C2 and C3 which are depicted the upper right of RDF resources in the model depict type of RDF resources. P1 in the model depicts an RDF property. In Fig. 3, at the beginning, P1 in the meta-model is modified to P1’ by a user. Along with that, corresponding the RDF property in the model is also modified by a meta-model management facility automatically. Next, C2 which is the type of RDF resource R1 in the model is modified to C2’ by a user. Along with that, corresponding the RDFS class in the meta-model is also modified by a meta-model management facility semi-automatically.
References¶
[Miller95] | G.A.Miller, “WordNet: A Lexical Database for English,” Commun. ACM, vol.38, no.11, pp.39.41, 1995. |
[Yokoi95] |
|
Functions¶
Contents
- Functions
Overview of MR3 functions¶
Fig. 4 shows a functional outline of MR3 . The goal of MR3 is to represent complicated models in a form that is as easy as possible for users to understand. MR3 provides three main functions: (1) graphical editing of RDF descriptions, (2) graphical editing of RDFS descriptions, and (3) meta-model management facilities, allowing several types of relationships in an RDF and RDFS description to be manipulated and managed. Here, the RDF elements considered are the RDF resource, RDF property and RDF literal, and the RDFS elements are the RDFS class and RDFS property. In the definition of these functions, a data graph refers to any visual expression of the data model.
The details of each function are described below.
Graphical Editing of RDF Descriptions¶
Function (1) in Fig. 4, which represents the graphical editing of RDF descriptions, supports the manipulation of the resource-property-value relation as defined by the semantics of the RDF data model. This function consists of the following sub-functions:
- Transformation of RDF resources into an RDF data graph
- Transformation of an RDF data graph into RDF resources
Graphical Editing of RDFS Descriptions¶
Function (2) in Fig. 4, which represents the graphical editing of RDFS descriptions, supports the manipulation of the attributes of classes such as the class-subclass relation and the attributes of properties such as rdfs:domain, rdfs:range, and the property-subproperty relation, as defined by the semantics of the RDF Schema model. This function consists of the following sub-functions:
- Transformation of RDFS resources into an RDFS data graph
- Transformation of an RDFS data graph into RDFS resources
Meta-Model Management Facilities¶
Function (3) in Fig. 4, which represents meta-model management facilities, is defined in this context as the checking of the consistency of classes and properties. The consistency checking mechanism consists of several facilities, as detailed below.
Meta-model management facilities are categorized as O→M or M→O. O→M is the facility to reflect the change in an ontology (RDFS class and property) in a model (the type of an RDF resource and RDF property). M→O is the facility to reflect the change in a model in an ontology. Manipulation of RDFS Class and Manipulation of RDFS Property are O→M facilities. Replace the Type of an RDF Resource and Replace RDF Property are M→O facilities.
O→M: Manipulation of an RDFS Class¶
The manipulation function of an RDFS class is operated by the meta-model management facility, and consists of replacing and removing an RDFS class.
- Replace RDFS Class
- When a URI of an RDFS class is replaced, the type of the RDF resource (URI), which refers to the replaced RDFS class, is also replaced at the same time.
- Removal of RDFS Class
- When an RDFS class is removed, MR3 shows the list of RDF resources, which includes the removed RDFS class as a type. The user can choose (or empty) other RDFS classes as a type of RDF resource.
Replace URI of RDFS Class¶
when a URI of an RDFS class is replaced, the type of the RDF resource (URI), which refers to the replaced RDFS class, is also replaced at the same time. Fig. 5 shows an example of replacing a URI of an RDFS class. The left part of Fig. 5 shows the state before replacing ex:Book class and the right part of Fig. 5 shows the state after replacing ex:Book to dc:BibliographicResource class.
In the RDFS part in the following figures, rectangles represent RDFS classes, ellipses represent RDFS properties, arrows represent rdfs:subClassOf or rdfs:subPropertyOf properties. In the RDF part in the following figures, ellipses represent RDF resources, arrows represent RDF properties, and labels at the upper right of ellipses represent types of RDF resources.
ex:The-Emotion-Machine and ex:The-Society-of-Mind are RDF resources that have ex:Book as their type. If the users replace the URI of ex:Book to dc:BibliographicResource, the type of RDF resource, which refers to ex:Book class, is also replaced at the same time. In this case, the types of ex:The-Emotion-Machine and ex:The-Society-of-Mind (ex:Book class) are replaced with dc:BibliographicResource class.
Removal of RDFS Class¶
When an RDFS class is removed, MR3 shows the list of RDF resources, which includes the removed RDFS class as a type. The user can choose (or empty) other RDFS classes as a type of RDF resource.
Fig. 6 shows an example of removal of an RDFS class. When the users remove ex:Book class, it can not be maintained consistency beween RDF contents and RDFS contents. Because exBook class is types of ex:The-Emotion-Machine and ex:The-Society-of-Mind resources. In Fig. 6, the users select empty as their type to maintain the consistency.
Note
If a type of an RDF resource is empty, the type of the RDF resource become implicitly rdfs:Resource.
O→M: Manipulation of an RDFS Property¶
The manipulation function of an RDFS property is operated by the meta-model management facility, and consists of replacing and removing an RDFS property.
- Replace URI of RDFS Property
- When a URI of an RDFS property is replaced, the RDF property, which refers to the replaced RDFS property, is also replaced at the same time.
- Removal of RDFS Property
- When an RDFS property is removed, MR3 shows the list of the RDF properties which refer to the removed RDFS property. A user can choose other RDFS properties (or the default property – mr3:nil) as a property of the RDF resources.
Replace URI of RDFS Property¶
When a URI of an RDFS property is replaced, the RDF property, which refers to the replaced RDFS property, is also replaced at the same time. Fig. 7 shows an example of replacing a URI of an RDFS property. The left part of Fig. 7 shows the state before replacing ex:author property and the right part of Fig. 7 shows the state after replacing ex:author to dc:creator property. The-Emotion-Machine and The-Society-of-Mind resources have the ex:author property. If the users replace the ex:author property with the dc:creator property, the corresponding RDF properties are also replaced. In this case, The ex:author property that ex:The-Emotion-Machine and ex:The-Society-of-Mind resources have are automatically replaced with the dc:creator property|
Removal of RDFS Property¶
When an RDFS property is removed, MR3 shows the list of the RDF properties which refer to the removed RDFS property. A user can choose other RDFS properties (or the default property – mr3:nil) as a property of the RDF resources.
Fig. 8 shows an example of removal of an RDFS property. When the users remove ex:author property in the Property editor, it can not be maintained consistency between the RDF contents and the RDFS contents. Because ex:The-Emotion-Machine and ex:The-Society-of-Mind resources have the ex:author property. Here, in order to maintain the consistency, the users replace ex:author property with the default property (mr3:nil).
Note
In MR3 , mr3:nil is the default property. If any RDFS properties are not defined and the users create a statement, the property between resources in the statement become mr3:nil.
M→O: Replacing the Type of an RDF Resource¶
When it is not clear which RDFS class corresponds to the type of an RDF resource replaced by the user, the meta-model management facility is applied. When the type of an RDF resource replaced by the user is defined by the RDFS class, MR3 matches the type of the RDF resource and the RDFS class corresponding to the type of RDF resource. In addition, if the class is not defined, the user can choose one of the following:
- Replacing a URI of an RDFS class with that referred to before the user replaced the type of the RDF resource.
- Creating an RDFS class that has yet to be defined.
Fig. 9 and Fig. 10 show examples of replacing a type of an RDF resource.
Replacing a URI of an RDFS class¶
In Fig. 9, although dc:BibliographicResource class is not defined in the Class editor, the users replace the type of ex:The-Society-of-Mind (ex:Book class) with dc:BibliographicResource class. Here, in order to maintain the consistency, the users select replacing a URI of an RDFS class. In this case, the users replace ex:Book class with dc:BibliographicResource class. Therefore, the type of ex:The-Emotion-Machine (ex:Book) is automatically replaced with dc:BibliographicResource class.
Creating an RDFS class¶
In Fig. 10, ex:ScienceBook class is not defined and the users replace the type of ex:The-Society-of-Mind (ex:Book) with ex:ScienceBook class. Here, the users select to create ex:ScienceBook to maitain consistency.
M→O: Replacing the RDF Property¶
When it is not clear which RDF property corresponds to the RDFS property replaced by a user, the meta-model management facility is applied. When the RDF property which the user replaced is defined by the RDFS property, MR3 matches the RDF property and the RDFS property corresponding to the RDF property. If the property is not defined, the user can choose one of the following:
- Replace the RDFS property name with that referred to before the user replaced the RDF property.
- Create an RDFS property that has yet to be defined.
Fig. 11 and Fig. 12 shows examples of replacing an RDF property.
Replacing a URI of an RDFS property¶
In Fig. 11, although ex:author property is not defined in the Property editor, the users replace ex:author property that ex:The-Society-of-Mind resource has with dc:creator property. In order to maintain the consistency, the users select replacing a URI of an RDFS property. In this case, the users replace ex:author property with dc:creator property. Therefore, ex:author property that ex:The-Emotion-Machine has is automatically replaced with dc:creator property.
Creating an RDFS property¶
In Fig. 12, dc:creator property is not defined and the users replace the ex:author property that ex:The-Society-of-Mind resource has with dc:creator. Here, the users select to create dc:creator property to maintain consistency.
Other functions¶
Importing an RDF Document¶
When importing an RDF document, the type of RDF resource or an RDF property may not be defined as an RDFS class or an RDFS property. In this case, in order to maintain consistency, a type of RDF resource which is not defined as an RDFS class is created as a sub class of the rdfs:Resource class. In the same way, an RDF property which is not defined as an RDFS property is created.
Fig. 13 shows an example of importing an RDF document. The left side of Fig. 13 depicts the state before importing the RDF document. The right side of Fig. 13 depicts the state after importing the RDF document. ex:Book, with the type of ex:The_Emotion_Machine and ex:The_Society_of_Mind, is not defined as an RDFS class. Also ex:author in the RDF model is not defined as an RDFS property. In order to maintain consistency, MR3 creates a ex:Book class and ex:author property in the RDFS data graph automatically.
Keeping Element Names Unique¶
This function prevents RDF and RDFS from overlapping other element names when a user renames and creates an RDF or RDFS element. If duplication of an RDFS element name is allowed, consistency cannot be maintained.
Replacing namespace with prefix or URI with label¶
MR3 has a function to replace namespaces of resources with the corresponding prefixes that are defined in the Namespace Table. MR3 also has a function to replace URIs of resources with the value of rdfs:label property that the resources have.
Setting a Meta Class and Property¶
A user can set meta classes and properties in MR3 . This function controls whether to consider a resource of a certain type as a class or a property. For example, if a user sets owl:Class as a meta class and owl:ObjectProperty and owl:DatatypeProperty as meta properties, MR3 can import the class and property hierarchy in OWL. The default meta class is rdfs:Class and the default meta property is rdf:Property.
Validation¶
When constructing an RDF model, MR3 doesn’t check rdfs:domain and rdfs:range in the RDFS properties. However, MR3 can perform validation of an RDF model using vOWLidator. This function indicates the resources that don’t match the rdfs:domain and rdfs:range in the RDFS properties.
Note
In ontology based tools, the users must define domains and ranges of RDFS properties before using the RDFS properties to build RDF contents. In MR3 , the users can use RDFS properties without defining the domains and the ranges of the property to build RDF contents.
User manual¶
Contents
- User manual
Implementation architecture¶
Fig. 14 shows the system architecture of MR3 from the aspect of system implementation. MR3 is implemented in Java language, using the Java Swing user interface. MR3 uses JGraph for RDF(S) graph visualization, and Apache Jena for enabling the use of Semantic Web standards such as RDF, RDFS, and OWL. The Parser and Generator in MR3 are implemented using Jena APIs. By using these libraries, MR3 is implemented as an environment for graphical representation of Semantic Web descriptions. Additionally, MR3 also has a plug-in facility to extend its functionality. At present, MR3 offers two kinds of APIs for plug-in development: one for changing the MR3 data graph into a model object of Jena, and one for changing the model object of Jena into a MR3 data graph.
System overview¶
Fig. 15 shows the system overview of MR3 . MR3 consists of the Parser module, Generator module, Meta-Model Management module, Plug-ins, and User Interface. The user edits the RDFs description visually via the User Interface, which also includes the Graphical Modeler and Plug-in interfaces. The Graphical Modeler provides access to the basic functions of MR3 , while the Plug-in Interface provides access to the functions of the plug-ins. The input and output of MR3 are RDFs documents. The Parser analyzes input RDFs documents and makes further operations possible by transforming the RDFs document into a Jena model. Then, the Parser changes the Jena model into an internal data expression, and meta-model management is performed. Plug-ins are built using APIs provided by MR3 . The Generator changes the internal data expression into a Jena model. Finally, the Jena model is changed into an RDFs document.
Overview of the Graphical modeler¶
Fig. 16 shows a typical screen showing the Graphical Modeler interface of MR3 . The Graphical Modeler consists of five main windows; RDF Editor, Class Editor, Property Editor, Attribute Dialog, and Namespace Table.
The details of the graphical modeler are shown in the following sections.
RDF Editor¶
The RDF Editor allows the user to express the relationship between an RDF resource, RDF property, and RDF literal using a directed graph, and also allows the attributes of each element to be edited. The attributes of an RDF resource consist of a URI, the URI type, and the RDF resource type. The RDF resource type can be chosen using the Class Editor. The URI type can be chosen from either a URI or can be set as anonymous.
As shown in Fig. 17, RDF resources are represented as ellipses, RDF properties are represented as arrows, and RDF literals are represented as rectangles in the RDF editor . Types of RDF resources are shown at the upper right part of the RDF resources.
Toolbar in the RDF Editor¶
Icons in the toolbar in the RDF editor and the corresponding functions are shown in the following table.
Icon | Function |
---|---|
![]() |
Move nodes |
![]() |
Connect nodes |
![]() |
Select a corresponding RDFS class or property |
![]() |
Don’t select a corresponding RDFS class or property |
![]() |
Insert an RDF resource |
![]() |
Insert an RDF literal |
![]() |
Undo |
![]() |
Redo |
![]() |
Copy nodes |
![]() |
Cut nodes |
![]() |
Paste nodes |
![]() |
Remov nodes |
![]() |
Show resource find dialog |
![]() |
Set default magnification |
![]() |
Expand the RDF editor |
![]() |
Reduce the RDF editor |
![]() |
Set appropriate magnification |
![]() |
Group nodes |
![]() |
Ungroup nodes |
![]() |
Automatically layout the RDF graph |
Editing attributes of RDF resources¶
When users select an RDF resource in the RDF editor, the attributes of the RDF resource are shown in the Attribute Dialog ( Fig. 20 to Fig. 27 ). The attributes of RDF resources are URI, rdf:type, blank node or note, rdfs:label, and rdfs:comment. Here the blank nodes are RDF resources that are not named by URIs. Blank nodes can not be acceced from external documents. However, the blank nodes can be subjects or objects of statements. They are used to represent RDF resources that are difficult to name or structure RDF contents.
If users would like to set a URI of an RDF resource, they should select URI from the left side menus in the Attribute Dialog as shown in Fig. 20. Prefixes that are registered in the Namespace Table are shown in The prefix combo box. When users select one of the prefixes in the combo box, the corresponding namespace is shown in the RDF Resource text field. The users can input any URI in the text field. If the users would like to set an RDF resource as a blank node, the users should check the blank checkbox.
If the users would like to set a type to an RDF resource, the users should select the Type from the left side menu in the Attribute Dialog as shown in Fig. 21. The isType checkbox should be checked when the users input the type of an RDF resource. If the users would like to empty the type of an RDF resource, they should uncheck the isType checkbox.
When the users click the Select Type button, Select Resource Type Dialog are shown as shown in Fig. 22. The class hierarchy that is build in the Class editor is shown in the Select Resource Type Dialog. When the users select an RDFS class in the dialog, the namespace and ID of the selected class are set in the Attribute Dialog.
When the users input a URI that is not defined in the Class editor, RDF(S) contents management dialog is shown as shown in Fig. 23. In the RDF(S) contents management dialog, the users can select Rename or Create.
When the users click the JumpClass button, the type of an RDF resource is selected and the attributes of the type of the RDF resource are shown in the Attribute Dialog.
If the users would like to define the rdfs:label of an RDF resource, the users should select Label in the left side menu in the Attribute Dialog as shown in Fig. 24. After inputting language in the Lang text field and label in the Label text field, the language and the label are added in the table in the Attribute Dialog. If the users select a line in the table and click remove button, the selected label is removed.
If the users would like to define the rdfs:comment of an RDF resource, the users should select Comment in the left side menu in the Attribute Dialog as shown in Fig. 25. After clicking the Add button, the Edit Comment Dialog is shown.
First input language in the Lang text field and comment in the Comment text area. Then, click OK button. After that, the language and the label are added in the table in the Attribute Dialog. If the users select a line in the table and click Edit button, the users can edit the selected comment and the language. In the same way, if the user select a line in the table and click Remove button, the selected label is removed.
Editing attributes of RDF properties¶
If the users select an RDF property in the RDF Editor, the attributes of the RDF property are shown in the Attribute Dialog (Fig. 26). The users can edit the URI of the selected RDF property.
If the users check the isContainer checkbox and input a number, the users can set rdf:_1 to n property that is corresponding to the inputted number.
If the user check the Show Property Prefix Only checkbox, the users can only select prefixes that are only used in the defined RDFS properties. If the user uncheck the checkbox, the users can select all of the prefixes that are defined in the Namespace Table.
When the users input a URI which is not defined in the Property Editor, RDF(S) contents management dialog is shown as shown in Fig. 23. In the RDF(S) contents management dialog, the users can select rename the RDFS property or create an RDFS property.
When the users select one of the prefixes in the dialog, IDs of RDFS properties that are defined in the Property Editor and the namespace is correspond to the selected prefix are shown in the Property ID list.
When the users select one of the Property IDs and click (Jump) Property button, the RDFS property is selected and the attributes of the RDFS property are shown in the Attribute Dialog.
Editing attributes of RDF literals¶
When the users select an RDF literal in the RDF Editor, the attributes of the RDF literal are shown in the Attribute Dialog. (Fig. 27) The users can edit the contents of the literal, the attribute of language (xml:lang), and the data type of the literal. In the Literal text are, the users can input the contents of the literal. The users can also input language in the Lang text field. If the users set the data type of the literal, the users should check isType checkbox and select one of the types in the Type combobox. Language attribute and data type attribute are exclusive and the users only select one of them.
Class Editor¶
The Class Editor allows the users to edit the attributes of RDFS classes and the relationships between the classes.
Fig. 28 shows an screenshot of the Class Editor
Toolbar in the Class Editor¶
Icons in the toolbar in the Class editor and the corresponding functions are shown in the following table.
Icon | Function |
---|---|
![]() |
Move nodes |
![]() |
Connect nodes |
![]() |
Insert an RDFS class |
![]() |
Undo |
![]() |
Redo |
![]() |
Copy nodes |
![]() |
Cut nodes |
![]() |
Paste nodes |
![]() |
Remove nodes |
![]() |
Show resource search dialog |
![]() |
Set default magnification |
![]() |
Expand the Class Editor |
![]() |
Reduct the Class Editor |
![]() |
Set appropriate magnification |
![]() |
Group nodes |
![]() |
Ungroup nodes |
![]() |
Automatically layout the RDFS class graph |
Editing attributes of the Class editor¶
When the users select an RDFS class in the Class Editor, the attributes of the RDFS class are shown in the Attribute Dialog (Fig. 31 to Fig. 33). The users can edit the attributes of an RDFS class by selecting Base, Label, Comment, Instances, or UpperClasses items from the left side menu in the Attribute Dialog.
When the users select the Base item, the type of an RDFS class and the URI can be edited (Fig. 31). The types can be defined class class list in the Config Dialog. When the users select the Label item, the value of rdfs:label property can be edited. When the users select the Comment item, the value of rdfs:comment property can be edited. The methods for editing rdfs:label and rdfs:comment are same as RDF resource. When the users select the Instances item, the instances of the selected RDFS class are shown in the list (Fig. 32). When the users select the one of the items in the list, corresponding RDF resource is selected and the attributes of the RDF resource are shown in the Attribute Dialog. When the users select the UpperClasses item, the uppser classes of the selected RDFS class are shown in the list (Fig. 33).
Property Editor¶
The Property Editor allows the users to edit the attributes of RDFS properties and the relationships between the properties.
Fig. 34 shows an screenshot of the Property Editor
Toolbar in the Property Editor¶
Icons in the toolbar in the Property editor and the corresponding functions are shown in the following table.
Icon | Function |
---|---|
![]() |
Move nodes |
![]() |
Connect nodes |
![]() |
Insert an RDFS property |
![]() |
Undo |
![]() |
Redo |
![]() |
Copy nodes |
![]() |
Cut nodes |
![]() |
Paste nodes |
![]() |
Remove nodes |
![]() |
Show Resource Search Dialog |
![]() |
Set default magnification |
![]() |
Expand the Property Editor |
![]() |
Reduce the Property Editor |
![]() |
Set appropriate magnification |
![]() |
Group nodes |
![]() |
Ungroup nodes |
![]() |
Automatically layout the RDFS property graph |
Editing attributes of the Property editor¶
When the users select an RDFS property in the Property Editor, the attributes of the RDFS property are shown in the Attribute Dialog (Fig. 37 to Fig. 39). The users can edit the attributes of an RDFS property by selecting Base, Label, Comment, Region, Instance, or SuperProperties items in the left side menu of the Attribute Dialog. Base, Label, and Comment items are same as RDFS Class. The type list in the Base item can be defined in the property class list in the Config Dialog. When the users select Region item, domains and ranges of the selected RDFS property can be edited (Fig. 37). When the users select Instances item, RDF resource list that have the selected RDFS property is shown in the Attribute Dialog (Fig. 38). When the users select the one of the items in the list, the RDF resource is selected and the attributes of the RDF resource are shown in the Attribute Dialog. When the users select SuperProperties item, super properties of the selected RDFS property are shown in the list (Fig. 39).
Resource Search Dialog¶
The users can find resources (RDF resources, RDF properties, RDFS classes, and RDFS properties) by using Resource Search Dialog. Fig. 40 shows a screenshot of the Resource Search Dialog. The users can set search scope by checking the Graph Type (RDF, Class, or Property). When the users set a URI in the URI text field, resources that partially match the URI are shown in the Find Result list in the Resource Search Dialog. When the users select the one of the items in the list, corresponding resource is selected and the attributes of the resource are shown in the Attribute Dialog. The users can set the value of rdfs:label and rdfs:comment in the Label or Comment text field.
Namespace Table¶
The users can register perfixes and the corresponding namespaces in the Namespace Table. Fig. 41 shows a screenshot of the Namespace Table. When the users set a prefix in the Prefix text field, set a namespace in the NameSpace text field, and click Add button, the prefix and the namespace are added in the table in the Namespace Table. If the users would like to remove the prefix and the corresponding namespace, select the line in the table and click Remove button. If the users check the available checkbox, namespaces of resources in each editor are replaced with the corresponding prefix (This function is only available when the Display->URI menu is selected.). When the users set a URI of an resource, the Namespace Table is referred and the users can select the registered prefixes in the Attribute Dialog. When the users select one of the prefixes, the corresponding namespace is shown in the Namespace label or RDF Resource text field.
Remove Dialog¶
If an RDFS class is referred by a type of a resource or a domain or a range of a property, it is inconsistency when the RDFS class is removed. If an RDFS property is reffered in the RDF editor, it is inconsistency when the RDFS property is removed. In these cases, when the users remove those RDFS classes or properties, the Remove Dialog as shown in Fig. 42 is shown before removing them actually.
Removed RDFS classes or properties are shown in the upper part of Fig. 42. RDF resources that referred the removed RDFS classes as their type are shown in the RDF tab in the lower part of Fig. 42. RDF properties that referred the removed RDFS properties are also shown in the RDF tab. RDFS properties that refer removed RDFS classes as their domains or ranges are shown in the Property tab in the lower part of Fig. 42.
If the users check the Delete Checkboxes and click Apply button, RDF resources, RDF properties, and RDFS properties that listed in the lower part of the Remove Dialog stop referring to the removed RDFS classes or RDFS properties. Then, the RDFS classes and RDFS properties are actually removed.
If the users select one of the RDF resources, RDF properties, or RDFS properties, attributes of the selected resource are shown in the Attribute Dialog. Then, the users can edit the attributes to maintain consistency.
Import Dialog¶
The users can import RDF(S) documents described as RDF/XML, N3, N-Triple, or Turtle format to MR3 by using Import Dialog. Fig. 43 shows a screenshot of the Import Dialog. The parts of the Import Dialog (1 to 13 in Fig. 43) are shown below.
- Directory or URI
- Directories that RDF(S) documents are saved or URIs that are RDF(S) documents are shown in the list.
- Add Dir
- Add a directory in the Directory or URI list.
- Add URI
- Add a URI in the Directory or URI list.
- Remove
- Remove the selected directory or URI in the Directory or URI list.
- Syntax
- Select a syntax (RDF/XML, N3, N-Triple, or Turtle) of an RDF(S) document that the users would like to import
- Data Type
- Select a data type (RDF, RDFS, or OWL) of an RDF(S) document that the users would like to import
- Import Method
- If the users select Merge, an RDF(S) document is merged to the current project. If the users select Replace, an RDF(S) document is replaced with the current project.
- Find Resource
- The files in the Import File List are filtered by inputted keyword in the Find Resource text field.
- Import File List
- Files in the selected directory in the Directory or URI list are shown in the Import File List.
- Extension
- The files in the Import File List are filtered by selected extensions.
- Reload
- Reload the directories in the directory or URI list and the lates files are shown in the Import File List.
- Import
- Import an RDF(S) document to MR3 based on the set condition (syntax, data type, import method, and import file).
- Cancel
- Close the Import Dialog.
Export Dialog¶
The users can export RDF(S) data graphs in MR3 to an RDF(S) document as RDF/XML, N3, N-Triple, or Turtle syntax. Fig. 44 shows a screenshot of the Export Dialog. The parts of the Export Dialog (1 to 8 in Fig. 44) are described below.
- Syntax
- Select a syntax (RDF/XML,N-Triple,Turtle,N3, etc) of an RDF(S) document that the users would like to export.
- Data Type
- If the users check the RDF, Class, or Property checkbox, data graphs in the selected editor are exported to an RDF(S) document. (For example, if the users checks Class and Property, classes and properties are exported as an RDF(S) document.)
- Option
- If the users check Encode(UTF-8) checkbox, URIs of resources are encoded based on RFC3986. If the users check Selected checkbox, only selected nodes are exported. If the users check Abbrev checkbox, data graphs are exported as RDF/XML Abbreviation syntax. If the users check XMLbase checkbox, XMLBase declaration is added in the RDF(S) document.
- File
- Export an RDF(S) document based on the set condition (syntax, data type, and options).
- Image
- If the users select one of the data types (RDF, Class, or Property) and click Image button, the selected data graph is saved as an image file.
- Reload
- The latest data graph are exported based on the set condition and the source is shown in the 8 part.
- Cancel
- Close the Export Dialog.
- Show the source of RDFs models
- The users can confirm the source of an RDF(S) document that will be exported.
Config Dialog¶
The users can set configurations about basic, directory, proxy, meta class, layout, and rendering in the Config Dialog.
Basic¶
When the users select the Basic item as shown in Fig. 45, language, UI language, output encoding, font, base URI, and log file can be set. If a resource has many multilingual labels, the users should select the prior language. The prior language of labels can be set in the Lang text field. Labels with prior language are shown in each resource when the user select display->label menu. Language of UI such as menu can be set in the UI Lang list. The users can select ja (Japanese), en (English), or zh (Chinsese) from the UI Lang list. Output encoding can be used to export an RDF(S) document. The font of resources can be set by clicking Font Setting button and selecting a font from the font selecting dialog. Default namespace is set based on the Base URI. The directory that a log file is saved can be set by clicking Browse button and selecting the directory from the directory selection dialog.
Directory¶
When the users select the Directory item as shown in Fig. 46, work directory, plugins directory, and resources directory can be set. The work directory is a directory that is opened firstly when the users import an RDF(S) document. The plugins directory is a directory that plug-ins of MR3 are saved. The resources directory is a directory that property files are saved. The property files are defined labels that displayed in MR3 for each language.
Proxy¶
When the users select the Proxy item as shown in Fig. 47, a host name and a port number of a proxy server can be set. This configuration is necessary to import an RDF(S) document from a URI when the user’s environment is under a proxy server.
Meta Class¶
When the users select the Meta Class item as shown in Fig. 48, Class Class and Property Class can be set. If the users set a Class Class, MR3 regards resources that have the Class Class as their type as classes. If the users set a Property Class, MR3 regards resources that have the Property Class as their type as properties. These classes and properties are imported in the RDFS class editor or RDFS property editor.
In the initial setting, rdfs:Class is defined in Class Class and rdf:Property is defined in Property Class. If the users would like to import OWL classes and properties, owl:Class must be set as Class Class, owl:ObjectProperty and owl:DatatypeProperty must be set as Property Class.
Layout¶
When the users select the Layout item as shown in Fig. 49, methods for layout for each editor can be set.
Rendering¶
When the users select Rendering item as shown in Fig. 50, colors of each node (RDF resources, RDF literals, RDFS classes, and RDFS properties), colors of each selected node, and background color of each editor can be set. If the users uncheck the Color checkbox, all of the nodes become colorless. If the users check the Antialias checkbox, an edge of each node become smooth.
Plugins¶
When the users select Plugins sub menu in the Tool menu, the dialog as shown in Fig. 51 is shown. MR3 loads jar files in the plug-ins directory that is set in the Config Dialog. The plugins are shown in the list. If the users select one of the plugins, the description of the plugin is shown at the bottom of the dialog. If the users click Exec button, the selected plugin is executed. Please refer to Plugin Development to build MR3 plugins.
Validator¶
When the users select Validator sub menu in the Tool menu, the dialog as shown in Fig. 52 is shown. MR3 uses Apache Jena’s validation API (org.apache.jena.reasoner.ValidityReport ) and it is enabled to check if the data type of literals are defined based on a range of property.
Project Info¶
When the users select Project Info sub menu in the Tool menu, the dialog as shown in Fig. 53 is shown. The current project name, the number of RDF resources, the number of RDF literals, the number of RDF statements, the number of classes, the number of properties, the number of all resources, the number of all literals, the number of all statements are shown in the dialog.
Log Console¶
When the users select Show Log Console sub menu in the Tool menu, the dialog as shown in Fig. 54 is shown. The users can confirm the standard output and the standard error in the dialog.
About MR3¶
When the users select About MR3 sub menu in the Help menu, the dialog as shown in Fig. 55 is shown. The developer, version, license, project web site, contact, and libraries used in MR3 are shown in the dialog.
Toolbar¶
Icon | Function |
---|---|
![]() |
New MR3 project |
![]() |
Open MR3 project file |
![]() |
Save MR3 project file |
![]() |
Save as MR3 project file |
![]() |
Show Import Dialog |
![]() |
Show Export Dialog |
![]() |
Show Resource Search Dialog |
![]() |
Show RDF Editor to the front |
![]() |
Show Class Editor to the front |
![]() |
Show Property Editor to the front |
![]() |
Show Attribute Dialog to the front |
![]() |
Show Namespace Table to the front |
![]() |
Show Class, Property, and RDF Editors |
![]() |
Show Class and RDF Editors |
![]() |
Show Property and RDF Editors |
![]() |
Find previous |
![]() |
Find next |
![]() |
Validate RDFs contents |
![]() |
Show Plugin Management Dialog |
![]() |
Show Project Information |
![]() |
Show Log Console |
![]() |
Show Config Dialog |
![]() |
Show about MR3 |
Shortcut keys¶
Shortcut keys that can be used in MR3 ¶
- Ctrl-N
- Create new MR3 project. The users should select save the current project or delete it.
- Ctrl-O
- Open MR3 project file
- Ctrl-S
- Save MR3 project file
- Ctrl+Shift+S
- Save as MR3 project file
- Ctrl+Q
- Exit MR3
- Alt+R
- Show the RDF Editor to the front
- Alt+C
- Show the Class Editor to the front
- Alt+P
- Show the Property Editor to the front
- Alt+A
- Show the Attribute Dialog
- Alt+N
- Show the Namespace Table
- Alt+F
- Show the Find Resource Dialog
Shortcut keys that can be used in editors¶
- Ctrl-A
- Select all of the nodes in a editor
- Delete
- Delete selected nodes in a editor
- Ctrl-C
- Copy selected nodes in a editor
- Ctrl-X
- Cut selected nodes in a editor
- Ctrl-V
- Paste nodes that are copied or cut.
Tutorial¶
Contents
Overview¶
In this tutorial, we build an RDF document that is introduced in RDF Primer (Example 1: RDF/XML Describing Eric Miller as shown below) by using MR3 .
There are two ways to build the RDF document by using MR3 . One is a top down method. In the top down method, the users firstly build RDFS contents and then build RDF contents by using classes and properties defined in the RDFS contents. The users can also use an existing RDFS document by importing the document into MR3 .
The other is a bottom up method. In the bottom up method. the users can create RDFS classes and properties when they build RDF contents by using RDF(S) contents management facilities.
In this tutorial, we introduce both of them. You can also check how to build the RDF document from the videos page in the MR3 web site. Finally, we describe an example of replacing an RDFS document.
Example 1: RDF/XML Describing Eric Miller
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:contact="http://www.w3.org/2000/10/swap/pim/contact#">
<contact:Person rdf:about="http://www.w3.org/People/EM/contact#me">
<contact:fullName>Eric Miller</contact:fullName>
<contact:mailbox rdf:resource="mailto:em@w3.org"/>
<contact:personalTitle>Dr.</contact:personalTitle>
</contact:Person>
</rdf:RDF>
Building an RDF document by the top down method¶
1. Registering prefixes and namespaces that are used in the RDF document¶
At the begininng, the users should register prefixes and the corresponding namespaces in the Namespace Table to build the RDF document. The Namespace table can be shown by selecting icon in the toolbar or selecting Show Namespace Table sub menu in the Window menu.
In the following figure, contact prefix and the corresponding namespace (http: //www.w3.org/2000/10/swap/pim/contact#) are registered in the Namespace Table. When the users input a prefix in the Prefix text field, input a namespace in the NameSpace textfield, and select Add button, they are registered in the Namespace Table.
Prefixes and namespaces can be used to create resources (RDF resources, RDF properties, RDFS classes, and RDFS properties).
2. Inserting an RDFS class¶
In this step, we insert contact:Person class in the Class editor.
First, when the users click a right mouse button in the Class Editor, a popup menu is shown. An RDFS class can be iserted by selecting Insert Class menu in the popup menu. The following figure shows the popup menu.
In the example RDF document, contact:Person class is the type of http: //www.w3.org/People/EM/contact#me resource. In MR3 , a type of an RDF resource can be selected from classes in the Class editor. Therefore, in order to select the type of the RDF resource, contact:Person class must be defined before creating the RDF resource by the top down method.
After selecting Insert Class menu, the following dialog is shown. The RDFS class (contact:Person) is inserted by selecting contact prefix from the Prefix combobox, inputting Person in the ID text field, and selecting the OK button.
3. Inserting RDFS properties¶
In this step, insert RDFS properties in the example RDF document (contact:fullName,contact:mailbox,contact: personalTitle).
When the users click a right mouse button in the Property Editor, a popup menu is shown. After selecting Insert Proerty menu, the following dialog is shown. An RDFS property is inserted by selecting a prefix from the Prefix combobox, inputting id in the ID text field, and selecting the OK button.
In MR3 , an RDF property can be selected from the properties in the Property Editor. Therefore in order to select an RDF property, the corresponding RDFS property must be defined before using the RDF property by the top down method.
The following figure shows a dialog when the users insert contact:fullName property in the Property Editor.
The following figure shows a screenshot after inserting contact:Person class, contact:fullName,contact:mailbox,and contact:personalTitle properties.
4. Inserting RDF resources¶
In the following steps, we build RDF contents based on the RDFS class and the RDFS properties built by above steps.
First, insert an RDF resource in the RDF Editor. When the users click a right mouse button in the RDF Editor, a popup menu is shown. The following figure shows a screenshot showing the popup menu.
After selecting Insert RDF Resource menu, the following dialog is shown. A type of an RDF resource can be selected from Resource Type combobox. Types of RDF resources can be selected from RDFS classes in the Class Editor. Here, select contact:Person class as a type of an RDF resource. Then, input http://www.w3.org/People/EM/contact#me in the RDF Resource text field. The RDF resource is inserted after selecting the type of the RDF resource, inputting the URI of the RDF resource, and select the OK button.
In the same way, insert mailto:em@w3.org as an RDF resource in the RDF Editor. Select empty as the type of mailto:em@w3.org.
Note
Here, since http://www.w3.org/People/EM/contact# and the corresponding prefix are not defined in the Namespace Table, we input URI of the RDF resource directly in the RDF Resource text field. If the namespace and the prefix are registered in the Namespace Table, the namespace is automatically inserted in the RDF Resource text field by selecting the corresponding prefix in the Prefix combobox. In addition, if the users check the blank checkbox, the RDF resource become blank node.
5. Inserting RDF literals¶
In this step, insert Eric Miller and Dr. RDF literals in the RDF Editor.
When the users click a right mouse button in the RDF Editor and select Insert Literal menu in the popup menu, the following dialog is shown. An RDF literal is inserted after inputting strings in the Literal text area and selecting OK button.
6. Inserting RDF properties¶
In this step, insert RDF properties in the RDF Editor.
First, change connect mode by clicking a right mouse button and selecting Connect Mode menu as shown below. The users also can change the connect mode by clicking icon in the toolbar.
Second, move the mouse cursor to the center of an RDF resource, drag the mouse cursor to the center of an RDF resource or an RDF literal, and drop the mouse cursor. Then, two nodes are connected with an RDF property. If the users do not select one of the RDFS properties in the Property Editor, the RDF property become mr3:nil which is the default RDF property in MR3 . If the users select one of the RDFS properties, the selected RDFS property is used for the RDF property.
Here, connect http: //www.w3.org/People/EM/contact#me RDF resource and Eric Miller literal with contact:fullName RDF property. In the same way,connect the RDF resourcre and Dr. literal with contact:personalTitle property. Connect the RDF resource and mailto:em@w3.org resource with contact:mailbox property.
In order to edit an RDF property, the Attribute Dialog is used. The Attribute Dialog is shown by clicking icon in the toolbar or selecting Show Attribute Dialog menu in the popup menu in the RDF Editor.
The following figure shows a screenshot of the Attribute Dialog when the users select an RDF property. An RDF property can be edited by selecting a prefix from the Prefix combobox, selecting an id from Property ID list, and selecting Apply button.
7. Exporting the RDF contents as an RDF document¶
Finally, export the RDF contents as an RDF document.
As a result, the following RDFS classes, RDFS properties, and an RDF model are created in each editor.
First, show the Export Dialog by selecting Export sub menu in the File menu or selecting icon in the toolbar.
Second, select Syntax, Data Type, and Option. Here, select RDF/XML as the syntax and select RDF checkbox to export only RDF model as RDF/XML format. The source of the RDF document is shown at bottom part of the Export Dialog.
When the users select File button, a Save dialog is shown. Then, you can select or create a file to export the RDF document.
Building an RDF document by the bottom up method¶
1. Registering prefixes and namespaces that are used in the RDF document¶
This step is same as the step1 in the top down method.
2. Inserting RDF resources and creating an RDFS class¶
This step is almost same as the step4 in the top down method.
The difference is the type of http: //www.w3.org/People/EM/contact#me resource is not defined in the Class Editor at this time. In the bottom up method, the users can create an RDFS class while editing an RDF resource.
The attributes of http: //www.w3.org/People/EM/contact#me resource are shown in the Attribute Dialog by selecting the resource and showing the Attribute Dialog. Then, select Type item in the left side list. After that, Check isType checkbox, select contact from the Prefix combobox, and input Person in the Resource Type ID. If the selected class is defined in the Class Editor, the selected class can be set as a type of an RDF resource. In this case, since the selected class (contact:Person) is not defined in the Class Editor, the selected class can not be set as the type of the RDF resource in this state. In this situation, MR3 performs an RDF(S) management facility to maintain consistency. When the users click Apply button in the Attribute Dialog, RDF(S) management dialog is shown as follows.
If the users click the Yes button in the RDF(S) management dialog, contact:Person class is created in the Class Editor as follows.
3. Inserting RDF literals¶
This step is same as the step5 in the top down method.
4. Inserting RDF properties¶
This step is almost same as the step6 in the top down method.
The difference is RDFS properties are not defined in the Property Editor at this time. In the bottom up method, the users can create an RDFS property while editing an RDF property.
First, select an RDF property and show the Attribute Dialog. At this time, RDF resources and literals are connected with mr3:nil property.
Second, uncheck the Show Property Prefix Only checkbox. If this checkbox is checked, the users only select prefixes that RDFS properties defined in the Property Editor have. In this case, since any RDFS properties are not defined in the Property Editor, uncheck the checkbox to select contact prefix.
Third, select contact prefix in the Prefix combobox. since there are no Ids in the Property ID list, input an id in the ID text field and click Apply button. Then, the RDF(S) management dialog is shown to maintain the consistency. The following figure shows a screenshot when the users input fullName in the ID text field and click the Apply button.
If the users click the Yes button in the RDF(S) management dialog, contact:fullName property is created in the Property Editor as follows.
Create contact:mailbox and contact:personalTitle properties in the same way.
5. Exporting the RDF contents as an RDF document¶
This step is same as the step7 in the top down method.
An example of replacing RDFS contents¶
The users can replace an RDFS contents by selecting RDFS as Data Type, selecting Replace as Import Method, and selecting Import button in the Import Dialog as shown below.
In the following descriptions, prefix animal represents http://example.com/animal# and prefix mr3 represents http://mr3.sourceforege.net#.
Before replacing an RDFS contents¶
In the following, example RDFS and RDF documents are shown.
An RDFS document before replacing¶
In the RDFS document, three classes are defined. They are mr3:Animal, mr3:Dog, and mr3:Cat classes. mr3:Dog and mr3:Cat classes are sub class of mr3:Animal class.
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:mr3="http://mr3.sourceforge.net#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:animal="http://example.com/animal#"
xml:base="http://mr3.sourceforge.net#">
<rdfs:Class rdf:ID="Dog">
<rdfs:subClassOf>
<rdfs:Class rdf:ID="Animal"/>
</rdfs:subClassOf>
</rdfs:Class>
<rdfs:Class rdf:ID="Cat">
<rdfs:subClassOf rdf:resource="#Animal"/>
</rdfs:Class>
<rdf:Property rdf:ID="play"/>
</rdf:RDF>
An RDF document before replacing¶
In the RDF document, mr3:Pochi is an RDF resource and it’s instance of mr3:Dog. mr3:Tama is an RDF resource and it’s instance of mr3:Cat class. mr3:Pochi is connected to mr3:Tama with mr3:play property.
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:mr3="http://mr3.sourceforge.net#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:animal="http://example.com/animal#"
xml:base="http://mr3.sourceforge.net#">
<mr3:Dog rdf:ID="Pochi">
<mr3:play>
<mr3:Cat rdf:ID="Tama"/>
</mr3:play>
</mr3:Dog>
</rdf:RDF>
The following figure shows a screenshot of the RDF and RDFS model before replacing.
An RDFS document to be replaced¶
In the example, the following RDFS document is replaed with the previous RDFS document. The difference is the namespace of classes and properties. The base namespace of the RDFS document before replacing is http://mr3.sourceforge.net#. On the other hand, the base namespace of the RDFS document to be replaced is http://example.com/animal#.
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:mr3="http://mr3.sourceforge.net#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:animal="http://example.com/animal#"
xml:base="http://mr3.sourceforge.net#">
<rdfs:Class rdf:about="http://example.com/animal#Animal"/>
<rdfs:Class rdf:about="http://example.com/animal#Cat">
<rdfs:subClassOf rdf:resource="http://example.com/animal#Animal"/>
</rdfs:Class>
<rdfs:Class rdf:about="http://example.com/animal#Dog">
<rdfs:subClassOf rdf:resource="http://example.com/animal#Animal"/>
</rdfs:Class>
<rdf:Property rdf:about="http://example.com/animal#play"/>
</rdf:RDF>
Replace RDFS Dialog¶
When the users import an RDFS document with replace option, the Replace RDFS Dialog is shown. In the dialog, current class list and current property list are shown. If the users select up arrow or down arrow button to match a class in the current class list to a class in the replace class list, the selected class is replaced. A property in the current property list can be replaed in the same way.
Here, mr3:Animal class is replaced with animal:Animal class, mr3:Dog class is replaced with animal:Dog class, and mr3:Cat class is replaed with animal:Cat class respectively. In addition, mr3:play property is replaed with animal:play property. When the users select Apply button, current RDFS document is replaced with new one. The following figure shows the Replace RDFS Dialog.
MR3 automatically matches classes and properties before replacing and classes and properties after replacing according to the following priority.
- URIs are same
- IDs are same
If there are no classes or properties that match above, classes and properties after replacing become NULL. In this case, classes aftere replacing become empty and properties after replacing become mr3:nil.
After replacing an RDFS contents¶
The RDF document after replacing an RDFS document is shown below. Types of RDF resources and RDF properties in an RDF model are also replaced. In this case, the type of mr3:Pochi (mr3:Dog) is replaced with animal:Dog and the type of mr3:Tama (mr3:Cat) is replaced with animal:Cat. In addition, the relationship between mr3:Pochi and mr3:Tama (mr3:play property) is replaced with animal:play property.
The RDF document after replacing an RDFS document¶
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:mr3="http://mr3.sourceforge.net#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:animal="http://example.com/animal#"
xml:base="http://mr3.sourceforge.net#">
<animal:Dog rdf:ID="Pochi">
<animal:play>
<animal:猫 rdf:ID="Tama"/>
</animal:play>
</animal:Dog>
</rdf:RDF>
The following figure shows a screenshot of the RDF and RDFS model after replacing.
Plugin Development¶
In this page, we introduce the class related to develop MR3 plugin (net.sourceforge.mr3.plugin.MR3Plugin class). We also explain how to develop MR3 plugins and show examples of MR3 plugins.
MR3 Plugin Class¶
net.sourceforge.mr3.plugin.MR3Plugin class (hereinafter, referred to as “MR3Plugin class”) is an abstract class which has an abstract method (abstract public void exec()). In order to develop MR3 plugin, firstly, create a class that inherits MR3Plugin class and overrides the exec method in the class. MR3Plugin class provides several utility methods. MR3 plugin developers can import an instance of com.hp.hpl.mesa.rdf.jena.model.Model interface (hereinafter, referred to as “Jena Model”) to MR3 data graphs and export MR3 data graphs to Jena Model by using the utility methods. The utility methods are shown as follows. (If you’d like to get more information, please refer to JavaDoc MR3Plugin.)
- protected JDesktopPane getDesktopPane()
- Get JDesktopPane. It is used to create internal window in MR3 .
- protected void replaceRDFModel(Model model)
- Replace Jena Model with existing RDF graph in MR3 .
- protected void mergeRDFModel(Model model)
- Merge Jena Model to existing RDF graph in MR3 .
- protected void mergeRDFSModel(Model model)
- Merge Jena Model to existing RDFS graph in MR3 .
- protected void replaceProjectModel(Model model)
- Replace Jena Model to MR3 project. The model in this method parameter is created from a MR3 project file.
- protected Model getRDFModel()
- Get Jena Model from the RDF graph in MR3 .
- protected JGraph getRDFGraph()
- Get org.jgraph.JGraph object from the graph in RDF Editor.
- protected JGraph getClassGraph()
- Get org.jgraph.JGraph object from the graph in Class Editor.
- protected JGraph getPorpertyGraph()
- Get org.jgraph.JGraph object from the graph in Property Editor.
- protected Model getSelectedRDFModel()
- Get Jena Model from the selected nodes in the RDF graph.
- protected Model getRDFSModel()
- Get Jena Model from the RDFS graph.
- protected Model getSelectedRDFSModel()
- Get Jena Model from the selected nodes in the RDFS graph.
- protected Model getClassModel()
- Get Jena Model from the graph in Class Editor.
- protected Model getSelectedClassModel()
- Get Jena Model from the selected nodes in the Class editor.
- protected Model getPropertyModel()
- Get Jena Model from the graph in Property Editor.
- protected Model getSelectedPropertyModel()
- Get Jena Model from the selected nodes in the Property editor.
- protected Model getProjectModel()
- Get Jena Model from the MR3 project.
How to develop MR3 plugins¶
- Create a class that inherits MR3Plugin class and overrides public void exec() method.
- Create a manifest file including plugin class name and the plugin name as follows. After that creating a jar file including the plugin class and the manifest file. (Plugin class name and the plugin name are necessary. Creator, date, and description attributes are options.)
Name: Plugin class name
plugin-name(or menu-name): Plugin name
creator: creator name
date: update date
description: description of the plugin
- Put the crated jar file in the MR3/plugins directory or the directory that is set as class path.
When the users select Plugins sub menu in the Tool menu, the Plugins dialog is shown and developed plugins are listed in the Plugins dialog. When the users select one of the plugins and click Execute button, the exec method that is overrided in the selected Plugin class is executed.
Sample Plugins¶
A sample manifest file and samples plugins are described as follows. The sample plugins can be download from MR3PluginSamples .
A sample manifest file¶
Manifest-Version: 1.0
Name: net.sourceforge.mr3.plugins.samples.ReplaceRDFModelSample.class
menu-name: ReplaceRDFModelSample
creator: Takeshi Morita
date: 2004-01-24
description: Replace RDF Model Sample Program.
Name: net.sourceforge.mr3.plugins.samples.GetRDFModelSample.class
plugin-name: GetRDFModelSample
creator: Takeshi Morita
date: 2004-01-24
description: Get RDF Model Sample Program.
Name: net.sourceforge.mr3.plugins.samples.OpenProjectSample.class
plugin-name: OpenProjectSample
creator: Takeshi Morita
date: 2004-01-24
description: Open Project File Sample Program.
Name: net.sourceforge.mr3.plugins.samples.SelectNodesSample.class
plugin-name: SelectNodesSample
creator: Takeshi Morita
date: 2004-01-24
description: This plugin select mr3:a, mr3:b and mr3:c nodes.
Name: net.sourceforge.mr3.plugins.samples.GroupNodesSample.class
plugin-name: GroupNodesSample
creator: Takeshi Morita
date: 2003-12-23
description: This plugin group mr3:a, mr3:b and mr3:c nodes.
Name: org.semanticweb.mmm.mr3.owlPlugin.OWLImportPlugin.class
menu-name: OWLImportPlugin
creator: Takeshi Morita
date: 2004-01-24
description: This is owl import plugin.