Some questions about SMW

From semantic-mediawiki.org

Hello all,

at the moment i am becoming crazy looking for information about different aspects of the SMW, and would be cool if someone could help me with them.

1) How can i import ontologies into my SMW? I want to import DublinCore one and another one which i have in ".owl" format, is there any way?

 With import i mean having the possibility to use the vocabulary itself on my forms, i would like to have categories and properties automatically created from these ones.
 
 I know there is a way of making a property which is "equal" to external ontologies vocabulary this way:
 https://semantic-mediawiki.org/wiki/Help:Import_vocabulary#Making_vocabularies_available_for_import
 
 But this is not what i am looking for. I just want to click "properties"for example and have vocabulary there.


2) Hide deleted properties, categories.......

 Whenever i go to my properties place, i find thousands of them with the yellow "warning" sign, which makes you know they have been deleted. I simply want to hide them so they do not botter me when i want to 
 see the actual vocabulary.


Well, this is all for the moment.

Thanks.

17:38, 18 March 2015

> With import i mean having the possibility to use the vocabulary itself on my forms, i would like to have categories and properties automatically created from these ones.

Forms and imported vocabularies don't share any commonalities or functionality. SMW is used under the premise of explicit type declarations. Of course you can create ad-hoc properties but those are defaulted to the page type and should be adjusted to a type it is ought to represent.

As for imported property references (e.g. foaf, dc), the following discussions should give you a quick overview of what is supported and how [0, 1].

> I just want to click "properties"for example and have vocabulary there.

I'm not sure I understand the comment.

> Whenever i go to my properties place, i find thousands of them with the yellow "warning" sign, which makes you know they have been deleted.

Again, I'm not sure I understand the comment/question. Do you mean by "properties place" the Special:Properties page? In case you mean Special:Properties, see $smwgPropertyZeroCountDisplay.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/891

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/464#issuecomment-70341109

18:21, 18 March 2015

I will put an example of what i mean with import:

FOAF has:

Classes:

Agent | Document | Group | Image | LabelProperty | OnlineAccount | OnlineChatAccount | OnlineEcommerceAccount | OnlineGamingAccount | Organization | Person | PersonalProfileDocument | Project |

Properties:

account | accountName | accountServiceHomepage | age | aimChatID | based_near | birthday | currentProject | depiction | depicts | dnaChecksum | familyName | family_name | firstName | focus | fundedBy | geekcode | gender | givenName | givenname | holdsAccount | homepage | icqChatID | img | interest | isPrimaryTopicOf | jabberID | knows | lastName | logo | made | maker | mbox | mbox_sha1sum | member | membershipClass | msnChatID | myersBriggs | name | nick | openid | page | pastProject | phone | plan | primaryTopic | publications | schoolHomepage | sha1 | skypeID | status | surname | theme | thumbnail | tipjar | title | topic | topic_interest | weblog | workInfoHomepage | workplaceHomepage | yahooChatID |


According to : http://xmlns.com/foaf/spec/

I need a way to import classes and properties into my web, so that i go into "Special:properties" and see the foaf classes as if they were introduced by hand in the web. Same with properties, when i go to "Special:properties".

Is it a bit clearer now?


I tried to follow the import marked on :

https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/464#issuecomment-70341109

But this did not do the thing for me.



Issue 2:

Even if this was not what i was looking for:

Help:$smwgPropertyZeroCountDisplay.

Thanks! It will help me. I just wanted to hide properties which had been deleted, not those with 0 uses :).

Hope you can help me with imports now. Thanks for your time!

14:57, 19 March 2015

Issue 1: As the documentation says, after creating the page for the vocabulary import (MediaWiki:Smw import foaf, for example), you have to include (manually or via template/transclusion) [[imported from::foaf:knows]] statement in a property page or in a category page (if it is a class).

Issue 2: I don't have an answer for this. I have the same problem for years.

23:11, 19 March 2015

Issue 1: I already mentioned i did that, but that was not what i was looking for! I am looking for a way to automatically import all vocabulary into the web, without the need to create things one by one each time.

00:55, 20 March 2015

> for a way to automatically import all vocabulary

A semi-automatic approach is being described above by [1].

> without the need to create things one by one each time.

As I mentioned earlier "SMW is used under the premise of explicit type declarations." which means you need at least to declare a connection between a property (Property:A) and its external representation (imported from::foaf:name) otherwise how should the system (SMW) know the attributive connection between an internal and external term.

To import something without making an explicit declaration is not how SMW ought to work. One can write a tool that would help with those assignments but since each wiki uses individual named properties to assign values, it can not be assumed that Property:Foaf:name on wiki-A means (in terms of its entity description) the same thing as Property:Foaf:name on wiki-B (even though the common sense would dictate such conjecture) because those assumption are not declarative.

SMW does not reserve the foaf/dc (or any other) namespace for exclusive use by an external vocabulary making it therefore not feasible to assume that Property:Foaf:name represents an external foaf:name entity (this is where we use imported from to assign the meaning of an external vocabulary to a property of one's own choosing).

> things one by one each time.

You only create a declaration once per property.

01:31, 20 March 2015

OK thanks, so i can understand with this that there is no way of an automatic vocabulary import.

The way i was thinking, was (for example) that if i have

FOAF


Classes

Agent | Document | Group | Image | LabelProperty | OnlineAccount | OnlineChatAccount | OnlineEcommerceAccount | OnlineGamingAccount | Organization | Person | PersonalProfileDocument | Project |


Properties

account | accountName | accountServiceHomepage | age | aimChatID | based_near | birthday | currentProject | depiction | depicts | dnaChecksum | familyName | family_name | firstName | focus | fundedBy | geekcode | gender | givenName | givenname | holdsAccount | homepage | icqChatID | img | interest | isPrimaryTopicOf | jabberID | knows | lastName | logo | made | maker | mbox | mbox_sha1sum | member | membershipClass | msnChatID | myersBriggs | name | nick | openid | page | pastProject | phone | plan | primaryTopic | publications | schoolHomepage | sha1 | skypeID | status | surname | theme | thumbnail | tipjar | title | topic | topic_interest | weblog | workInfoHomepage | workplaceHomepage | yahooChatID |


With this description:


Class: foaf:Agent


Agent - An agent (eg. person, group, software or physical artifact). Status: stable Properties include: gender yahooChatID account birthday icqChatID aimChatID jabberID made mbox interest tipjar skypeID topic_interest age mbox_sha1sum status msnChatID openid holdsAccount weblog Used with: maker member Has Subclass Group Person Organization The Agent class is the class of agents; things that do stuff. A well known sub-class is Person, representing people. Other kinds of agents include Organization and Group.

The Agent class is useful in a few places in FOAF where Person would have been overly specific. For example, the IM chat ID properties such as jabberID are typically associated with people, but sometimes belong to software bots.



Making me have a Category called "Agent" with that description, those properties and linked with other subclases. Even if it is not available atm, i do not think it would be impossible to make an automatic vocabulary creator, which started by introducing properties, and followed with classes.(At least with well known ontologies).


I was looking for this because at the moment i have to introduce apart from the dublin core vocabulary (not so extensive) another ontology in ".owl" which has like 100 categories (or classes) and some hundreds of properties also....so doing it manually EACH time (i need to do it more than once) is kind of hard.

15:43, 20 March 2015

> I was looking for this because at the moment i have to introduce apart from the dublin core vocabulary (not so extensive) another ontology in ".owl" which has like 100 categories (or classes) and some hundreds of properties also....so doing it manually EACH time (i need to do it more than once) is kind of hard.

Your scenario can not be codified in rules that would be applicable and working for each potential user that would need such import feature.

SMW provides the infrastructure to actual make such models available depending on a users scenario without restriction on how to model.

In your case (as it seems you need to do it for more than on wiki) I would urge you to write a small tool where you specify your rules and then run the import once per wiki.

We do similar things with our integration tests [0, 1] where rules are codified (in terms of 'imported from' to property relation) and automatically created each time the test is run. This may or may not helpful to you in writing a tool that would suit your needs.

As I also mentioned earlier, strict typing of imported vocab. is only supported starting with [2].

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/tests/phpunit/Integration/Rdf/rdf-003-import-foaf.json

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/tests/phpunit/ByJsonTestCaseProvider.php#L101

[2] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/891

16:35, 20 March 2015

Ok thanks. Is there any way then to create more than one property of category at the same time from scratch?

For example in Special:createproperty

"Knows Text


Autor Page

"


In createForm

"

{{Plant 1
|Knows=
|Autor=
}}



{{Plant 2
|Knows=
|Autor=
}}

"


So that i do not have to enter it all hand by hand each time. Perhaps this peace of code you put helps:


{ "description": "Rdf output for imported foaf annotated vocabulary (requires import before property declaration)", "properties": [], "subjects": [ { "name": "Smw import foaf", "namespace": "NS_MEDIAWIKI", "contents": "http://xmlns.com/foaf/0.1/%7CFriend Of A Friend\n name|Type:Text\n homepage|Type:URL\n mbox|Type:Email\n mbox_sha1sum|Type:Text\n depiction|Type:URL\n phone|Type:Text\n Person|Category\n Organization|Category\n knows|Type:Page\n member|Type:Page\n" }, { "name": "Foaf:homepage", "namespace": "SMW_NS_PROPERTY", "contents": "foaf:homepage" }, { "name": "Foaf:mbox", "namespace": "SMW_NS_PROPERTY", "contents": "Text foaf:mbox" }, { "name": "Foaf:name", "namespace": "SMW_NS_PROPERTY", "contents": "Text foaf:name" }, { "name": "Foaf:knows", "namespace": "SMW_NS_PROPERTY", "contents": "Page foaf:knows" },

], }


But i would like to do something similar for forms and templates.

15:32, 23 March 2015

(This could solve my problem, more or less).

Is there any way to indicate some category is subcategory of other one without entering in the page of him?


Something like

Category1
Category2
Category2


Having this i could create my Category hierarchy manually all in the same page, which is not an import, but would make me able to advance quite much.

17:29, 23 March 2015