Relating classes in ontology - taxonomy

I have problems relating classes (not individuals) in my ontology. I need to know which one
OWL(full-dl-lite) allows to relate classes.
i mean the domain and range of property be http://www.w3.org/2002/07/owl#Class.
Is it possible to do that?
thanks for any hint.

First, forget about the spec at http://www.w3.org/TR/owl-guide/, http://www.w3.org/TR/owl-ref/ and http://www.w3.org/TR/owl-semantics/. The official recommendation for a Web Ontology Language is OWL 2, where the various sublanguages are OWL 2 EL, OWL 2 QL, OWL 2 RL, OWL 2 DL and OWL 2 Full (read about the new features of OWL 2). OWL Lite does not exist anymore and should be forgotten forever.
Second, in OWL (both 1 and 2), it has always been possible to relate classes using annotation properties, like this in Turtle:
# valid in all variants and OWL 1 and OWL 2
:prop a owl:AnnotationProperty .
:C1 a owl:Class .
:C2 a owl:Class;
:prop :C2 .
In OWL 1, it was not possible to define a domain or range for an annotation property but it is now possible in OWL 2:
# works in all variants of OWL 2
:prop a owl:AnnotationProperty;
rdfs:domain owl:Class;
rdfs:range owl:Class .
Your other option is to rely on the notion of "punning", that is, using the IRI of a class for an individual, like so:
# works in all variants of OWL 2
:prop a owl:ObjectProperty .
:C1 a owl:Class .
:C2 a owl:Class;
:prop :C2 .
However, you cannot use owl:Class as the domain or range of an object property. The last possibility is to not care and use OWL (1/2) Full:
# works in OWL 1 Full, OWL 2 Full
:prop rdfs:domain owl:Class;
rdfs:range owl:Class .
:C1 a owl:Class;
:prop :C2 .
Note that most OWL DL reasoners will not crash on that input (more precisely, all reasoners that I've ever tested would not crash), so it's pretty safe in fact.

Related

How do I specify two different background sources for mobile and desktop version respectively through same molecule's mixin in index.pug content?

I am using the pug templating engine to design the front-end of my website, and would want to make it responsive (desktop and mobile compatible), however, I have different background images for the desktop and mobile views respectively, and would like to know of a way to specify the different sources of background images for the same component within a mixin in JSON format. Here is the code where I am calling the jcfcards mixin:
block content
.flexboxcontainer
+jcfbanner
+jcfcards({"src": "/assets/images/Letter-J.png", "text":"Career Map"})
+jcfcards({"src": "/assets/images/Letter-C.png", "text":"Competencies"})
+jcfcards({"src": "/assets/images/Letter-F.png", "text":"Learning Roadmap"})
Here is the code for the jcfcards mixin:
mixin jcfcards(spec)
- spec = spec || {}
- spec.__class = spec.__class || ''
div(style=`background-image:url('${spec.src}')`).jcfcardtitle(class=spec.__class)&attributes(attributes)
if spec.text == "Career Map"
p.careerMap= spec.text
else
p= spec.text
.icon-long-right
If there is any other way I can tackle this problem, I would highly appreciate any inputs on that as well. :)

How to name twig files by the region they are in?

I am using Drupal with the Commerce Module to build a webshop. I am using the Commerce Cart Block to display a cart icon with the amount of items in the cart, in the navigation bar.
Now I would also like to display the Cart Block on the Cart page, but with a different template than being used in the navigation bar.
I am using the debug mode, which let me see what I could call the file names to use them like I would like to. But above both Cart Blocks it says the same file name, so I can't output two different templates. I tried putting primary_menu-- before the navigation cart block and content-- (the region the cart block is going to be in), but they don't work.
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'commerce_cart_block' -->
<!-- BEGIN OUTPUT from 'themes/custom/verdamigo/templates/commerce-cart-block.html.twig' -->
This is shown above both cart blocks (which are on the same page). So how can I use two different templates for both blocks.
primary_menu--commerce-cart-block.html.twig
is not working.
I would like to be able to edit both the block in the primary_menu and the block in the content-region. But both carts get output with the same template.
In an effort to decouple Blocks from Displays, Drupal 8 renders a block independently of which display it's in and what region/weight it has in that display (see Twig Template naming conventions) :
Region-specific block templates are not available in Drupal 8.
This removes the ability to override block.tpl.php by region, and for hook_preprocess_block() to adjust variables based on it. Instead, core developers recommend to manage block template overrides with CSS or using additional blocks.
But you can still work around this by implementing hook_theme_suggestions_HOOK_alter() :
function SOME_theme_suggestions_block_alter(array &$suggestions, array $variables) {
if (!empty($variables['elements']['#id'])) {
$block_id = $variables['elements']['#id'];
$block = Drupal\block\Entity\Block::load(block_id);
$region = $block->getRegion();
// Allow per-region block templating.
$suggestions[] = 'block__' . $region . '__' . $block_id;
}
return $suggestions;
}
Note : the template name should begin with "block" since you override a block template, so in your case the override file should be named block--primary_menu--commerce-cart-block.html.twig.

How to merge css in wordpress

I want to merge all css into one file. I can do manually but I don't understand last argument of wp_register_style.
From laptop it's load all css.
wp_register_style('desktop-small-css', get_template_directory_uri().'/css/desktop.small.css','','','(max-width:'.get_option($dynamo_tpl->name . '_theme_width', '1230').'px)');
wp_enqueue_style('desktop-small-css');
wp_register_style('tablet-css', get_template_directory_uri().'/css/tablet.css','','','(max-width:'.get_option($dynamo_tpl->name . '_tablet_width', '1030').'px)');
wp_enqueue_style('tablet-css');
wp_register_style('tablet-small-css', get_template_directory_uri().'/css/tablet.small.css','','','(max-width:'.get_option($dynamo_tpl->name . '_small_tablet_width', '820').'px)');
wp_enqueue_style('tablet-small-css');
wp_register_style('mobile-css', get_template_directory_uri().'/css/mobile.css','','','(min-width:'.get_option($dynamo_tpl->name . '_mobile_width', '580').'px)');
wp_enqueue_style('mobile-css');
https://codex.wordpress.org/Function_Reference/wp_register_style,
I guess it's a mediaquery, find out which stylesheet is for which device and remove/edit the $media option.
It might be a lot easier to remove the $media option of all wp_register_style and add #media() media queries inside your stylesheets.

How can I repeat a certain number of icons using Polymer?

I just need to do something simple, but I'm baffled how to go about it.
I have a list of students with a certain number of credits. I want to display one star for every credit completed.
e.g.,
John ★
Sarah ★★
Ken ★
Jared ★★★★
The student's info is contained in JSON that is bound to each student's div, so it can be accessed via {{student.credits}} etc., but something like <template repeat> doesn't seem to be made for something like this. I also thought maybe I could just add a class such as star2 and override the default icon CSS but since each icon uses a SVG, it doesn't want to repeat like a standard image background would.
Any helps or pointers would be greatly appreciated!
You can use the trick I have used in rating-element web component.
Create an array whose length will conveniently be the number of credits:
created: function () {
this._credits = new Array(this.credits);
},
Use this convenient array in the repeat template:
<template repeat="{{_ in _credits}}"></div>
<div>★</div>
</template>
As a reference you can take a look at the complete component in the devel branch, specifically the template repeat and the created callback code fragments.
Im keen on php it would be like
For($i=0; $i <= $score; $i++){
echo "<img src='images/star.jpg' />";
}

How to increase by 1 withing (private static function)

I'm working on a new website with an API of Bol.com and I'm stuck at the moment.
My question is really simple, but i cant solve this issue. I just want to have a number for every div which needs to increase by 1.
This code will result an book within a div:
private static function printIndex($product) {
echo '<div id="indexboxes">';
echo '<div id="itemleft"><img src=" ' . $product->getImagemedium() . ' " width="135" height="210"></div>';
echo '<div id="itemmiddle">';
echo '<div id="itemmiddlename"><h2>' . $product->getTitle() . "</h2></div>";
echo '<div id="itemmiddlepub"><h3> ' . $product->getPublisher() . "</h3></div>";
echo '</div></div>';
}
It needs to be like this:
Number 1
Image
Title
Publisher
Number 2
Image
Title
Publisher
Number 3
Image
Title
Publisher
etc..
The image, title and the publisher is working already.. But the numbers doesnt work.
How can get the numbers in this div?
Thanks!
You can use something better than <h2>. Why not use an ordered list <ol> element and list items <li> instead. You can use CSS counters and li:before to get the "Number ?" before each item.
Why not use HTML and CSS capabilities when they are the most natural way of doing the job? In any case, using this print method and putting ids on your divs will cause ids to be used more than once on the same page. You do not want to do that; ids must be unique.
I suggest you do a static mockup of what you want your page to look like; don't use PHP, use lists for styling, and use CSS to format the text sizes and the 'Number' prefix you want. Then, add the PHP to get the dynamism you want.
I would pass the index into your function by reference: eg:
private static function printIndex($product, &$idx) {
// your code
$idx++;
}