Some subclasses seem deliberately missing from the SSN ontology RDF. Is there a way to import a complete SSN ontology? - ontology

I am using Protege to explore the SSN ontology,
but a lot of classes like the survivalRange seem to be missing from the main file.
How could I import all the classes and entities of the ssn-system,
without importing them manually one by one by the IRI?

You can import http://www.w3.org/ns/ssn/systems/, which itself imports http://www.w3.org/ns/ssn/.

Related

How to avoid writing an import for every single file in dart/flutter?

I am making a flutter application and I created a file/class for each custom widget I am using. Then, I imported all of these files into the main screen but I don't like how it looks. Especially because if I want to add another widget or delete the one I would need to fiddle with the imports.
Is there something like C# namespaces where I can just make one import for all files in folder/namespace?
I already tried using library/part with success but then in https://www.dartlang.org/guides/libraries/create-library-packages says that I should avoid using part/part of. So, are we expected to import each and every file?
Instead of having:
import 'package:custom_widgets/custom_multiplechoice.dart';
import 'package:custom_widgets/custom_singlechoice.dart';
import 'package:custom_widgets/custom_time.dart';
import 'package:custom_widgets/custom_yesnochoice.dart';
import 'package:custom_widgets/custom_date.dart';
I would like to have:
import 'package:custom_widgets';
Yes there is, you can use export to achieve what you want.
You can place all your widgets in a folder, for example libs/src/ and then create file custom_widgets.dart in libs/ and use export like this inside custom_widgets.dart:
export 'src/custom_multiplechoice.dart';
export 'src/custom_singlechoice.dart';
export 'src/custom_time.dart';
export 'src/custom_widgets/src/custom_yesnochoice.dart';
export 'src/custom_date.dart';
Once you import custom_widgets.dart, all those widgets will be available to you.
Check this out, its all explained here: Dart: Organizing a library package
Update:
In Dart there are no namespaces like in most other languages.
Dart uses libraries for encapsulation, data hiding.
Only way to import a class into your code is to use import in the beginning of your file, which should also be a library.
I have an issue with this too. Imagine a situation where you want to import library dynamically. Let's say you would like to implement MVC pattern in your application, if you are doing this on the server, you would have a Router class that would analyze URL and decide what Controller class to instantiate and what Method from that Controller to invoke. Now every URL would trigger different Controller, and you don't know it in advance, its up to your Router to detect a Class to instantiate. What you need to do in this situation is import every Controller that could get instantiated at the beginning of your file. And I have issues with that. What if your application gets big and you have to import lets say 20 Controller classes, just so Router / Dispatcher can invoke one of them, and in reality you will invoke only one Controller, as there is only Controller per URL.
Don't have issues with manual loading of Libraries, if they are going to be used, but for situation like described above, Dart fails as there is no "auto loading" of classes like in for example PHP, where you can use auto loaders that use namespaces to find out about location of your class and instantiate a class in the middle of the code dynamically.
There is this extension for VSCode which can help to create this.
Dart Barrel File Generator

Import class from an inplacePlugin to another inplacePlugin Grails

I need use a domain class define in one inplacePlugin to a controller class in another inplacePlugin inside my app, but when I try to define the class IDE "cannot resolve the symbol". AutorDef domain class I define public in my app. What i need to do for reselve this issue?
def autor = AutorDef.findAll()
I already know how can do it that, it is very simple, (of course after a few day of deep thinking and search). Here is the solution.
In BuildConfig.groovy inside the inplace plugin where we need import the domain class from other inplace plugin we add next code,
grails.plugin.location.'common'="../sdl-common"
We add this code directly below
grails.project.test.reports.dir = "target/test-reports"
The import code before equals
grails.plugin.location.'common'
is the name use for import the plugin data(domain class, etc) and
"../sdl-common"
is the route to inplace plugin, and when we need to import the data in our classes, or controllers, we only need add
import common.*
in the part where we import hte packages.

xtext: autoimport and -validate current package

I have two connected problems that I kind of know how to solve "by foot" (using custom validators and scope providers). But I'm surprised they don't work out of the box in xtext so I'll ask anyway (in case I missed something).
I have this DSL:
Model:
'package' name=QualifiedName
imports+=Import*
entities+=Entity*;
Import:
'import' importedNamespace=QualifiedName;
Entity:
name=ID '{'
references += Reference*
'}';
Reference:
name=ID':'entitiy=[Entity]
;
QualifiedName:
ID('.'ID)*
;
Apart from defining multiple entities in the same file I want to be able to define multiple files that "live" in the same package. And I have 2 problems here:
1) I found no obvious way to easily auto-import all elements from the current package. So If I have one file
package com.test
EntityA {}
and a second one
package com.test
import com.test.EntityA // fails if I remove this line
EntityB{
refToA:EntityA // I could make qualified names work here.
// But that is not the goal.
}
the reference to EntityA can't be resolved unless I explicitly import it (which is something that I want to avoid) although they are in the same namespace.
So: is there a way to easily enable outimports for the "current" package?
2) I have enabled the org.eclipse.xtext.validation.NamesAreUniqueValidator which works fine for entities defined in the same file. But if I redefine an imported entity like this
package com.test
import com.test.EntityA
EntityB{
refToA:EntityA
}
EntityA {}
I don't get the expected validation error. Is there something I can do about that without having to write my own validator?
Thx.
To make auto-imports work, you need to use Xbase and
Model:
'package' name=QualifiedName
importSection=XImportSection?
To use Xbase, append this to your grammar: with org.eclipse.xtext.xbase.Xbase
See http://www.lorenzobettini.it/2013/01/the_ximportsection_in_xbase_2_4/ for details.
The second one can only be solved with your own validator AFAIK. The reason is that you can have a grammar which allows:
import com.test.EntityA as X
private EntityA extends X {}

Import ontology from file (In which the ontology itself imports several other files)

In Jena I'm loading an ontology into a Model, using this code:
Model model = FileManager.get().loadModel("/path/myontology.owl");
My problem is that "myontology.owl" imports another ontology with owl:imports. In pseudo code lets just say that "Myontology.owl" imports other files to complete the ontology, since several individuals are declared in external files, e.g.:
In myontology.owl
Import → myontologywithindividuals.owl
My problem is that I can't import the ontology with its individuals into a single Model in Jena. That is,
Model model = FileManager.get().loadModel("/path/myontology.owl");
doesn't seem to work. Any idea why? How can I import this correctly?
Plain models in Jena don't do any processing of owl:imports, because plain RDF doesn't have any notion of importing other documents. Ontology imports are an OWL concept, and you'll need to use an OntModel if you want imports processing. You may need to use setDynamicImports() to enable import processing. If the imports statements refer to ontologies using their ontology IRI, but you want to retrieve them from a local file, you may also need to setup the OntModel's OntDocumentManager and FileManager to take care of the appropriate mapping from IRIs to local files.

Warning that 'imported libraries have the same name when they DO NOT"

I have the following import statements in a class
import 'package:dart_web_toolkit/ui.dart';
import '../../util/flex_table_builder.dart' as ftBldr;
import '../factors_list_view.dart';
class MediatingFactorsView extends Composite
{
//...
}
However, the last import statment is flagged with a warning:
The different imported libraries 'flex_table_builder.dart' and 'factors_list_view.dart' should not have the same name
The names are quite different and I see this being repeated throughout my code after I updated to the latest Dart Editor. Is this a bug?
Make sure that you are assigning library names to each file. The first line of the file should be:
library foo;
You should use different names for each library that you use. The library name is specified by the library directive, but anonymous libraries are treated as having the same name, which is where the warning comes from.
It is a warning in the Dart specification to import two libraries with the same name.
You can read more about how to use libraries here in the language tour.
You could follow the Package layout conventions.
For the error :
The different imported libraries onset_view.dart and duration_view.dart should not have the same name
you should define distinct library names in each imported dart file.
One additionnal note, you should use import 'package:epimss/shared.dart'; instead of import 'packages/epimss/shared.dart'; and import 'site_view.dart'; instead of import './site_view.dart';
The warnings correctly indicate there is a problem.
The correct solution depends on if the Dart files are conceptually separate from each other or are related.
Different libraries
If they are conceptually separate, then they should be defined as belong to different libraries with different library names.
The import command is used to reference a compilation unit from a different library, not a compilation unit that belongs to the same library. It expects every library to have a unique library name.
If a Dart file is treated as a library (i.e. is the subject of an import statement) and is not explicitly named then its implicit name is the empty string. In this case, both files are treated as libraries, and it is complaining about there being two libraries with the same name (of an empty string).
For this to work as separate libraries, given them different names:
Top file:
import 'foo.dart';
import 'bar.dart';
foo.dart:
library foo;
bar.dart:
library bar;
Part of the same library
But if they related they should not be referenced as libraries. That is, do not use the import command. Use the part command, which treats the Dart file as compilation unit that belongs to the same library.
Top file:
library baz;
part 'foo.dart';
part 'bar.dart';
foo.dart:
part of baz;
bar.dart:
part of baz;
Only the top library file can contain the part statements. You do not need (and cannot have) part statements inside the other files, even if they reference definitions from each other. If there are multiple files, just list them all in the top library file (in any order).
Although the implicit name for a library is the empty string, there is no way to use that when there are multiple parts involved: so even if these files are never going to be imported as a library, you will still need to explicitly assign it a library name.
Always remember: import and part statements are very different from the #include macro in the C preprocessor.

Resources