I have three ontologies and I want to define mappings between their properties.
For example there are three properties (2 datatype properties and an objectproperty) in each one of them to define the pedagogical level (the ontologies describe pedagogical resources).
The three properties are:
hasContext1 (domain: the resource, range: skos concept (which is a class))
hasContext2 (domain: the resource, range: list / xsd:literal)
hasContext3 (domain: the resource, range: xsd: string)
Is there any way to map between these three properties?
Thanks
Hiba
Related
Neo4j's manual does a very good job at explaining the meaning of the terms Node, Relationship, Label and a few others.
However, the real vocabulary of Cypher seems to include quite a few elusive terms, as well.
For instance, clause 3.3.15.1 of the manual says "Lists and paths are key concepts in Cypher". Fine, but what is a List in Cypher? I have all but given up trying to find a definition of that "key concept".
Similarly, the Cypher Reference Card mentions that "Cypher also supports maps and collections". Elsewhere, one can find that Cypher also "works with dictionaries".
Needless to say, I am in the dark as to how to spot and/or use those in Cypher.
Would really appreciate some illustrations.
Thanks.
The docs has a section on Composite types:
3.2.1.3. Composite types
✓ Can be returned from Cypher queries
✓ Can be used as parameters
❏ Cannot be stored as properties
✓ Can be constructed with Cypher literals
Composite types comprise:
Lists are heterogeneous, ordered collections of values, each of which has any property, structural or composite type.
Maps are heterogeneous, unordered collections of (key, value) pairs, where:
the key is a String
the value has any property, structural or composite type
You might also be interested in the development of openCypher. One of the goals of the openCypher project is to define the concepts of the Cypher language. As stated on its homepage:
The openCypher project aims to deliver a full and open specification of the industry’s most widely adopted graph database query language: Cypher.
Currently, openCypher is a work-in-progress. It has a draft document on the Property Graph Model, which itself does not discuss lists/maps in detail, but refers the CIP2015-06-16 - Public Type System and Type Annotations document, which is an accepted Cypher Improvement Proposal. It has a section on "Container Types", which defines how lists and maps work in Cypher.
I have not seen the term "dictionary" in the core Neo4j docs. It could be mentioned around drivers though, as some languages, e.g. Python, use this term for maps.
(Disclaimer: I am a regular participant at the openCypher Implementers Group meetings.)
According to wikipedia :
https://en.wikipedia.org/wiki/List_(abstract_data_type) : a list (or sequence, collection) is a data type that represents a countable number of ordered values.
https://en.wikipedia.org/wiki/List_(abstract_data_type) : a map (or dictionnary) is a data type composed of a collection of (key, value) pairs.
And in Cypher :
this is a list : RETURN ['Benoit', 'Simard'] AS list
this is a map : RETURN { firstname:'Benoit', lastname:'Simard'} AS map
Cheers
I'm using pizza ontology, and there is this object property called hasCountryOfOrigin. This object property doesn't have specific domain and range, probably because the domain can be pizza or pizzaTopping. For other object properties, for example hasBase, I can find where it's used with ontology.getAxioms(AxiomType.OBJECT_PROPERTY_DOMAIN) because it has domain and range. So how can I find where hasCountryOfOrigin is used using OWLAPI?
You can use:
Searcher.values(ontology.axioms(AxiomType.OBJECT_PROPERTY_ASSERTION), property);
This will provide all assertions that have property as the property, e.g., all axioms of the form subject property value.
You can then iterate over the axioms and check the types for the subject and object to infer possible domains and ranges from usage.
(Note that these do not force the property to have these classes as domains or ranges; it's just that those classes would not surprise a reasoner or a human looking at the ontology, if they were to be asserted to be domains or ranges of the property.)
In my Neo4j/SDN project I have to implement a following task - I have a parent Node(let's say ParentNode) that must define a set of product characteristics, for example:
weight: Double
size: Integer
license: String
active: Boolean
Also, new product characteristics(with any new name and type) can be added during the application runtime.
ParentNode can have a set of child nodes(let's say ProductNode) and each of these nodes can provide an own value for a certain characteristic defined by a ParentNode.
Based on these characteristics names and values I need to have possibility to filter a ProductNode nodes.
Previously this structure have been implemented by me by SDN3 DynamicProperties but AFAIK - DynamicProperties support has been removed from SDN 4.
So my question is - how to implement the following structure based on SDN 4 ?
UPDATED
Also, how about the idea to define every ParentNode characteristic as a separate node(let's say CharacteristicNode)
for example
CharacteristicNode.name = weight
CharacteristicNode.type = Double
CharacteristicNode.name = license
CharacteristicNode.type = String
...
and every ProductNode can provide a value node(CharacteristicValueNode) associated with ProductNode and CharacteristicNode.
The main question here how to support different types for CharacteristicValueNode and how to filter ProductNode nodes based on different characteristic and their values?
In SDN 4, you can model these properties as a Map of (property name, value) and write a custom converter. This will convert the Map to a String property on the node (json style perhaps), and then from the graph back to your Map.
The downside to this is that it is not easy to write a custom query for these dynamic properties because they're not really stored in the graph as independent properties- rather, your converter will squash them into a single one.
Update
If you were to define each Characteristic type as a node (in your example, you would have 4 nodes- one representing each of weight,size,active,license), then you don't need an intermediate CharacteristicValueNode to relate the ProductNode and the CharacteristicNode. Instead, you can model the value of the produce for the characteristic on the relationship between the ProductNode and CharacteristicNode.
For example, if the ProductNode had only weight and size, then you would have two relationships- one from ProductNode to the weight CharacteristicNode with the weight value on the relationship, and another from the ProductNode to the size CharacteristicNode with the size value on that relationship.
In SDN 4, these would be modelled as RelationshipEntities. For example,
#RelationshipEntity(type="CHARACTERISTIC")
public class ProductCharacteristic {
Long id;
#StartNode ProductNode product;
#EndNode CharacteristicNode characteristic;
int value;
...
}
The ProductNode would contain a collection of these relationship entities
Set<ProductCharacteristic> characteristics;
Then you can query for products related to characteristics with a certain name. Or query for ProductCharacteristic with findByCharacteristicName
I haven't really tried this approach out, but it is worth thinking about the change that this forces in your underlying graph model to support dynamic properties.
I want to see the difference between two ontologies in Protege, and I used the 'Compare ontology' tool. I want to compare the properties of two ontologies rather than 'created', 'deleted', etc. How can I get that information?
I have questions about the syntax of this Cypher query:
MATCH (tom:Person {name: "Tom Hanks"})-[:ACTED_IN]->(tomHanksMovies)
RETURN tom, tomHanksMovies
I swear I've seen some paths that have two dashes, as in --[:ACTED_IN]. What is the difference between two and one dash?
The relationship in the MATCH pattern is: [:ACTED_IN]. I think it's safe to say that the key is missing because there is no need for an identifier.
By extension, then why doesn't (tomHanksMovies) need to be written to explicitly show that it is basically just an identifier, as in (tomHanksMovies:)? Or is it not an identifier? I've read it called a variable as well. What's the correct terminology?
You would have seen Cypher patterns like this: (a)-->(b), but never (a)--[:ACTED_IN]->(b), as the latter is not legal. The -- syntax just means that there is a relationship, but the relationship type does not matter (and you don't need to use any relationship properties).
You indicate an identifier as the first string after the ( for a node or [ for a relationship, as long as the string does not start with a : or { character. The : character is used before a node label or relationship type. The { and } characters are used enclose property name/value pairs.
An identifier is referred to that way in the neo4j documentation, so that is the preferred name. However, people often use variable as well.