I've created a (disk) database using stardog 2.0.0.
I've loaded my ontology and some data to this database.
I can see my ontology's axioms and this data when I execute the following command:
./stardog query -v --username user --passwd pass dbname "select * where { ?s ?p ?o }"
This is a selection of the returned axioms:
?s ?p ?o
| http://www.ugent.be/chest#Infection | rdf:type | owl:Class |
| http://www.ugent.be/chest#Infection | rdf:type | http://www.ugent.be/chest#RespiratoryInfection |
| http://www.ugent.be/chest#Infection | rdf:type | owl:NamedIndividual |
| http://www.ugent.be/chest#Infection | rdfs:subClassOf | http://www.ugent.be/chest#Pathology |
This is a selection of the returned data:
| <http://www.ugent.be/chest#Infection/4641> | rdf:type | <http://www.ugent.be/chest#Infection> |
| <http://www.ugent.be/chest#Infection/4642> | rdf:type | <http://www.ugent.be/chest#Infection> |
| <http://www.ugent.be/chest#Infection/4643> | rdf:type | <http://www.ugent.be/chest#Infection> |
| <http://www.ugent.be/chest#Infection/4644> | rdf:type | <http://www.ugent.be/chest#Infection> |
When I try to execute a query to retrieve all individuals with rdf:type Infection I get nothing.
./stardog query -v --username user --passwd pass "chest" "PREFIX : <http://www.ugent.be/chest#> select ?s where { ?s rdf:type :Infection }"
When I add reasoning type QL or EL I get
:Infection
When I add reasoning type DL I get:
com.clarkparsia.pellet.api.term.impl.entity.DataNotImpl cannot be cast to com.clarkparsia.pellet.api.term.entity.ClassExpression
The same goes for a consistency check.
Am i doiing something wrong?
DL reasoning is only permitted for queries over your TBox, so your given query won't be answered using reasoning; keep that in mind when using Stardog's reasoning capabilities.
With that said, you're never supposed to get a ClassCastException. Try with the latest Stardog, you're three releases behind, and if the problem still exists, send a self-contained minimal example to the mailing list and we'll be happy to fix it.
Related
I'm running a Neo4J 5.3.0 community edition and tried to load the dump from https://github.com/neo4j-graph-examples/twitch. I managed to load the dump and migrate the database.
My question: how do I use the "twitch" database?
cosh#osmingestor:~$ sudo neo4j-admin database info
Database name: neo4j
Database in use: true
Last committed transaction id:-1
Store needs recovery: true
Database name: system
Database in use: true
Last committed transaction id:-1
Store needs recovery: true
Database name: twitch
Database in use: false
Store format version: record-aligned-1.1
Store format introduced in: 5.0.0
Last committed transaction id:62742
Store needs recovery: false
show databases doesn't show it for my user "neo4j":
neo4j#neo4j> show databases;
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name | type | aliases | access | address | role | writer | requestedStatus | currentStatus | statusMessage | default | home | constituents |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| "neo4j" | "standard" | [] | "read-write" | "localhost:7687" | "primary" | TRUE | "online" | "online" | "" | TRUE | TRUE | [] |
| "system" | "system" | [] | "read-write" | "localhost:7687" | "primary" | TRUE | "online" | "online" | "" | FALSE | FALSE | [] |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
I tried to grant access to the database by executing:
neo4j#neo4j> grant all database PRIVILEGES ON DATABASES * TO neo4j;
Unsupported administration command: grant all database PRIVILEGES ON DATABASES * TO neo4j
Adding "neo4j" as the default admin did not help as well (was working though):
neo4j-admin dbms set-default-admin neo4j
I am trying to build my custom ROS services. They are inside a another parent package
the structure is as follows:
|--catkine_ws
| |--src
| | |--Parent
| | | |--CMakeLists.txt
| | | |--package.xml
| | | |--ChildA
| | | | |--CMakeLists.txt
| | | | |--package.xml
| | | | |--srv
| | | | | |--SomeService.srv
| | | |--ChildB
The packages are building correctly and I am able to use them in other nodes and packags.
however when I try to use rossrv list the custom services do not appear. I think that this is causing some issues when I try to build my Simulink controller and it cannot find the service message definition.
Does any one have any idea what is going on?
I was able to fix the problem, while not obvious, the solution was rather simple. I had to change the slightly change the structure of the package by making the parent package a meta package then do some handling to make sure that the sub packages still had access to the cmakes to locate my external packages.
I have two nodes "A" (primary) & "B". Each node have 3 resources. On node "B" i replace disks and after that i add each resource as secondary. Two resources successfully connect and sync, but with one resource i have issue. When on node "B" i stop this resource, node "A" shows
lv1 role:Primary
disk:UpToDate
b.host connection:Connecting
When i starts this resource on node "B", node "A" shows:
lv1 role:Primary
disk:UpToDate
b.host connection:StandAlone
and node "B" shows:
lv1 role:Secondary
disk:Inconsistent
a.host connection:Connecting
I try everything, remove/add resource, metadata on node "B", remove data, rebuild raid drbdadm connect lv1 --discard-my-data etc.
One difference between worked an broken resources is This node was a crashed primary, and has not seen its peer since
+--< Current data generation UUID >-
| +--< Bitmap's base data generation UUID >-
| | +--< younger history UUID >-
| | | +-< older history >-
V V V V
E43824C7BC375B4A:626476078D91E933:CC1DC3FAD143EDCC:E4E71860FBA887C2:1:1:1:1:0:0:0:0:0:0:0:1
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
-< Data consistency flag >--+ | | | | | | | | | | |
-< Data was/is currently up-to-date >--+ | | | | | | | | | |
-< Node was/is currently primary >--+ | | | | | | | | |
-< This node was a crashed primary, and has not seen its peer since >--+ | | | | | | | |
-< The activity-log was applied, the disk can be attached >--+ | | | | | | |
-< The activity-log was disabled, peer is completely out of sync >--+ | | | | | |
-< This node was primary when it lost quorum >--+ | | | | |
-< Node was/is currently connected >--+ | | | |
-< The peer's disk was out-dated or inconsistent >--+ | | |
-< A fence policy other the dont-care was used >--+ | |
-< Node was in the progress of marking all blocks as out of sync >--+ |
-< At least once we saw this node with a backing device attached >--+
Any ideas how i can fix it?
UPD: Find new differences a kernel: drbd lv1/0 drbd1 b.host: The peer's disk size is too small! (999671944 < 1000196216 sectors)
In my case on node "A" (primary) i have LVM, on node "B" i have MDRAID. This differences give me difference in resource size in 524 272 sectors. What i do to save my data. I run both resources in primary mode, mount and copy data from "A" to "B", then i rebuild node "A" to MDRAID and sync resources.
If this full URL:
http://domain.com/dir/file.css
Is an "absolute URL", where the link will work from any website.
And this:
../dir/file.css
Is a "relative URL", where the link will only work from that directory path.
What is the combination of those two called…
/dir/file.css
Where the link will work from any location on that site?
Your first example is a URL. Your second and third examples are not URLs, they're paths. If the path begins with / then it's an absolute path, otherwise it's a relative path.
Web browsers generally understand how to interpret a path in relation to the "current" host and path.
You’re basically talking about a URI scheme. In your example:
/dir/file.css
This is considered the path:
/dir/
And this is the filename:
file.css
So saying “hostname plist path & filename” is a safe bet. Or perhaps /dir/file.css can be considered the root path since the / at the beginning anchors it to the hostname part of the URL.
This diagram from Wikipedia explains it well:
foo://username:password#example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose
\_/ \_______________/ \_________/ \__/ \___/ \_/ \______________________/ \__/
| | | | | | | |
| userinfo hostname port | | query fragment
| \________________________________/\_____________|____|/ \__/ \__/
| | | | | | |
| | | | | | |
scheme authority path | | interpretable as keys
name \_______________________________________________|____|/ \____/ \_____/
| | | | | |
| hierarchical part | | interpretable as values
| | |
| path interpretable as filename |
| ___________|____________ |
/ \ / \ |
urn:example:animal:ferret:nose interpretable as extension
path
_________|________
scheme / \
name userinfo hostname query
_|__ ___|__ ____|____ _____|_____
/ \ / \ / \ / \
mailto:username#example.com?subject=Topic
I'm playing with deriving instance type from its value information using value restrictions:
:SpaceMission rdf:type owl:Class .
:shuttleUsed rdf:type owl:ObjectProperty ;
rdfs:domain :SpaceMission .
:Apollo11 rdf:type owl:NamedIndividual .
:Mission11 rdf:type :SpaceMission , owl:NamedIndividual ;
:shuttleUsed :Apollo11 .
:ApolloMission rdf:type owl:Class ;
owl:equivalentClass [ rdf:type owl:Class ;
owl:intersectionOf ( :SpaceMission
[ rdf:type owl:Restriction ;
owl:onProperty :shuttleUsed ;
owl:hasValue :Apollo11
]
)
] .
The single value restriction owl:hasValue works fine and the SPARQL for type of :Mission11 returns :SpaceMission and :ApolloMission as expected. Then I add the second value restriction for definition of the class :ApolloMission:
:Apollo13 rdf:type owl:NamedIndividual .
:ApolloMission rdf:type owl:Class ;
owl:equivalentClass [ rdf:type owl:Class ;
owl:intersectionOf ( :SpaceMission
[ rdf:type owl:Restriction ;
owl:onProperty :shuttleUsed ;
owl:someValuesFrom [ rdf:type owl:Class ;
owl:oneOf ( :Apollo11
:Apollo13
)
]
]
)
] .
(The restriction type has automatically changed from owl:hasValue to owl:someValuesFrom). In this case the expected inference of type :ApolloMission for the individual :Mission11 is not returned, but only the :SpaceMission. Do I have something wrong? Or the the type inference is only possible with value restriction of type owl:hasValue?
I'm using Jena's OWLMicroReasoner and running the SPARQL query for
{<:Mission11> a ?type}. Maybe it is not able to infer from owl:someValuesFrom restriction. As I said the owl:hasValue restriction did work with Jena's micro reasoner. Does Jena's built-in reasoner support the owl:someValuesFrom restriction?
It's generally more helpful if you can provide an entire ontology that we can work with for testing. This one isn't too big, so it wasn't too hard to recreate. At any rate, I've reproduced it, and it's included at the end of this answer.
The inference is valid in OWL
The inference you're looking for is valid in OWL, and we can see that by using a logically complete OWL reasoner, e.g., Pellet. We'll see this in Protégé (but you could have used Pellet with Jena, too.) Here's what the ontology, recreated in Protégé look like:
Then, when we enable the Pellet reasoner and ask for instances of ApolloMission, we get Mission11, as expected:
Since you said you were asking for the types of Mission11, perhaps you used a query like asking for superclass of {Mission11}. This produces the expected classes, too:
Reproduced Ontology
#prefix : <http://stackoverflow.com/q/21223545/1281433/space.owl#> .
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#prefix owl: <http://www.w3.org/2002/07/owl#> .
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
#prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
#prefix space: <http://stackoverflow.com/q/21223545/1281433/space.owl#> .
<http://stackoverflow.com/q/21223545/1281433/space.owl>
a owl:Ontology .
space:Mission11 a owl:NamedIndividual , space:SpaceMission ;
space:shuttleUsed space:Apollo11 .
space:shuttleUsed a owl:ObjectProperty ;
rdfs:domain space:SpaceMission .
space:Apollo13 a owl:Thing , owl:NamedIndividual .
space:ApolloMission a owl:Class ;
owl:equivalentClass [ a owl:Class ;
owl:intersectionOf ( space:SpaceMission [ a owl:Restriction ;
owl:onProperty space:shuttleUsed ;
owl:someValuesFrom [ a owl:Class ;
owl:oneOf ( space:Apollo13 space:Apollo11 )
]
] )
] .
space:SpaceMission a owl:Class .
space:Apollo11 a owl:Thing , owl:NamedIndividual .
Why you don't get some results with Jena's reasoners
Jena's reasoners are not complete. That doesn't mean that they're not finished; complete is a technical term in formal reasoning describing a reasoner (or algorithm, etc.) that means that there are correct inferences according to the semantics of the language that the reasoner won't produce. The reason that Jena's reasoners are incomplete has to do with the implementation strategy (using a rule-based reasoner), and with efficiency considerations (we can accept a trade-off between speed and the inferences that we can get).
For more about Jena's reasoners, you should look at Reasoners and rule engines: Jena inference support from the documentation. It's not entirely up to date though, as it says, for instance:
The critical constructs which go beyond OWL/lite and are not supported
in the Jena OWL reasoner are complementOf and oneOf. As noted above
the support for unionOf is partial (due to limitations of the rule
based approach) but is useful for traversing class hierarchies.
but as the following code shows, there is, in fact, support for owl:oneOf in some of the reasoners, and so some of the reasoners can make the ApolloMission inference that you want.
Jena provides a number of reasoners, and the easiest way to get an OntModel that is connected to them is by using the static OntModelSpecs that are declared in OntModelSpec. The following Java code shows that with the final ontology that you provided, the different reasoners provide different results. (The reflective code for getting the different OntModelSpecs is a bit hackish, but for a quick example, it's fine.) The code constructs an OntModel for each of the declared specs starting with "OWL_", and runs the query against them.
import java.lang.reflect.Field;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.ResultSetFormatter;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
public class JenaReasonersSpaceExample {
private final static String QUERY =
"PREFIX : <http://stackoverflow.com/q/21223545/1281433/space.owl#>\n" +
"select ?type where {\n" +
" :Mission11 a ?type .\n" +
"}\n";
private final static Model base =
ModelFactory.createDefaultModel()
.read( "file:///home/taylorj/tmp/ontologies/space/space.owl" );
public static void main(final String[] args) throws IllegalArgumentException, IllegalAccessException {
// Iterate through the fields of OntModelSpec and for each one whose name
// begins with "OWL_", assume that it's a static field (so that getField
// can accept null), and that its value is an OntModelSpec (so that we
// can cast and create an OntModel with it and the base model).
// that begin with "OWL_", and assume t
for ( final Field field : OntModelSpec.class.getFields() ) {
if ( field.getName().startsWith("OWL_") ) {
final OntModelSpec spec = (OntModelSpec) field.get(null);
final OntModel model = ModelFactory.createOntologyModel( spec, base );
// Run the query against the model (that will use the specified reasoner)
// and show the field that we used and the results that we get.
System.out.println( "\n=== "+field.getName()+" ===" );
ResultSetFormatter.out(QueryExecutionFactory.create(QUERY, model).execSelect());
}
}
}
}
The output follows. Some of the reasoners can infer that Mission11 is an ApolloMission. These are the ones used by the specs: OWL_MEM_RULE_INF, OWL_MEM_MINI_RULE_INF, OWL_DL_MEM_RULE_INF, and OWL_LITE_MEM_RULES_INF. It looks like you might want to stick to reasoners that have RULE in the name.
=== OWL_MEM ===
------------------------------------------------------------------------
| type |
========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
------------------------------------------------------------------------
=== OWL_MEM_RDFS_INF ===
------------------------------------------------------------------------
| type |
========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
| <http://www.w3.org/2000/01/rdf-schema#Resource> |
------------------------------------------------------------------------
=== OWL_MEM_TRANS_INF ===
------------------------------------------------------------------------
| type |
========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
------------------------------------------------------------------------
=== OWL_MEM_RULE_INF ===
-------------------------------------------------------------------------
| type |
=========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
| <http://www.w3.org/2002/07/owl#Thing> |
| _:b0 |
| <http://www.w3.org/2000/01/rdf-schema#Resource> |
| _:b1 |
| <http://stackoverflow.com/q/21223545/1281433/space.owl#ApolloMission> |
-------------------------------------------------------------------------
=== OWL_MEM_MICRO_RULE_INF ===
------------------------------------------------------------------------
| type |
========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
| <http://www.w3.org/2002/07/owl#Thing> |
| <http://www.w3.org/2000/01/rdf-schema#Resource> |
------------------------------------------------------------------------
=== OWL_MEM_MINI_RULE_INF ===
-------------------------------------------------------------------------
| type |
=========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
| <http://www.w3.org/2002/07/owl#Thing> |
| _:b0 |
| <http://www.w3.org/2000/01/rdf-schema#Resource> |
| _:b1 |
| <http://stackoverflow.com/q/21223545/1281433/space.owl#ApolloMission> |
-------------------------------------------------------------------------
=== OWL_DL_MEM ===
------------------------------------------------------------------------
| type |
========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
------------------------------------------------------------------------
=== OWL_DL_MEM_RDFS_INF ===
------------------------------------------------------------------------
| type |
========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
| <http://www.w3.org/2000/01/rdf-schema#Resource> |
------------------------------------------------------------------------
=== OWL_DL_MEM_TRANS_INF ===
------------------------------------------------------------------------
| type |
========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
------------------------------------------------------------------------
=== OWL_DL_MEM_RULE_INF ===
-------------------------------------------------------------------------
| type |
=========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
| <http://www.w3.org/2002/07/owl#Thing> |
| _:b0 |
| <http://www.w3.org/2000/01/rdf-schema#Resource> |
| <http://stackoverflow.com/q/21223545/1281433/space.owl#ApolloMission> |
| _:b1 |
-------------------------------------------------------------------------
=== OWL_LITE_MEM ===
------------------------------------------------------------------------
| type |
========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
------------------------------------------------------------------------
=== OWL_LITE_MEM_TRANS_INF ===
------------------------------------------------------------------------
| type |
========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
------------------------------------------------------------------------
=== OWL_LITE_MEM_RDFS_INF ===
------------------------------------------------------------------------
| type |
========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
| <http://www.w3.org/2000/01/rdf-schema#Resource> |
------------------------------------------------------------------------
=== OWL_LITE_MEM_RULES_INF ===
-------------------------------------------------------------------------
| type |
=========================================================================
| <http://stackoverflow.com/q/21223545/1281433/space.owl#SpaceMission> |
| <http://www.w3.org/2002/07/owl#NamedIndividual> |
| <http://www.w3.org/2002/07/owl#Thing> |
| _:b0 |
| <http://www.w3.org/2000/01/rdf-schema#Resource> |
| <http://stackoverflow.com/q/21223545/1281433/space.owl#ApolloMission> |
| _:b1 |
-------------------------------------------------------------------------