Skip to content

Commit 4cb2e6d

Browse files
committed
More work on Intellisense
1 parent f25718b commit 4cb2e6d

File tree

5 files changed

+86
-33
lines changed

5 files changed

+86
-33
lines changed

OWLSharp/Ontology/Axioms/DataPropertyAxioms/OWLDataPropertyRange.cs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ namespace OWLSharp.Ontology
2828
public sealed class OWLDataPropertyRange : OWLDataPropertyAxiom
2929
{
3030
#region Properties
31+
/// <summary>
32+
/// Represents the property used for this data axiom (e.g: http://example.org/hasAge)
33+
/// </summary>
3134
[XmlElement(Order=2)]
3235
public OWLDataProperty DataProperty { get; set; }
3336

34-
//Register here all derived types of OWLDataRangeExpression
37+
/// <summary>
38+
/// Represents the datarange expression asserted to be range of the data property (e.g: http://www.w3.org/2001/XMLSchema#nonNegativeInteger)
39+
/// </summary>
3540
[XmlElement(typeof(OWLDatatype), ElementName="Datatype", Order=3)]
3641
[XmlElement(typeof(OWLDataIntersectionOf), ElementName="DataIntersectionOf", Order=3)]
3742
[XmlElement(typeof(OWLDataUnionOf), ElementName="DataUnionOf", Order=3)]
@@ -42,22 +47,29 @@ public sealed class OWLDataPropertyRange : OWLDataPropertyAxiom
4247
#endregion
4348

4449
#region Ctors
45-
internal OWLDataPropertyRange()
46-
{ }
50+
internal OWLDataPropertyRange() { }
51+
52+
/// <summary>
53+
/// Builds an OWLDataPropertyRange with the given data property and datarange expression as range
54+
/// </summary>
55+
/// <exception cref="OWLException"></exception>
4756
public OWLDataPropertyRange(OWLDataProperty dataProperty, OWLDataRangeExpression datarangeExpression) : this()
4857
{
49-
DataProperty = dataProperty ?? throw new OWLException("Cannot create OWLDataPropertyRange because given \"dataProperty\" parameter is null");
50-
DataRangeExpression = datarangeExpression ?? throw new OWLException("Cannot create OWLDataPropertyRange because given \"datarangeExpression\" parameter is null");
58+
DataProperty = dataProperty ?? throw new OWLException($"Cannot create OWLDataPropertyRange because given '{nameof(dataProperty)}' parameter is null");
59+
DataRangeExpression = datarangeExpression ?? throw new OWLException($"Cannot create OWLDataPropertyRange because given '{nameof(datarangeExpression)}' parameter is null");
5160
}
5261
#endregion
5362

5463
#region Methods
64+
/// <summary>
65+
/// Exports this OWLDataPropertyRange to an equivalent RDFGraph object
66+
/// </summary>
5567
public override RDFGraph ToRDFGraph()
5668
{
57-
RDFGraph graph = new RDFGraph();
69+
RDFGraph graph = DataProperty.ToRDFGraph();
70+
5871
RDFResource drExpressionIRI = DataRangeExpression.GetIRI();
59-
graph = graph.UnionWith(DataProperty.ToRDFGraph())
60-
.UnionWith(DataRangeExpression.ToRDFGraph(drExpressionIRI));
72+
graph = graph.UnionWith(DataRangeExpression.ToRDFGraph(drExpressionIRI));
6173

6274
//Axiom Triple
6375
RDFTriple axiomTriple = new RDFTriple(DataProperty.GetIRI(), RDFVocabulary.RDFS.RANGE, drExpressionIRI);

OWLSharp/Ontology/Axioms/DataPropertyAxioms/OWLDisjointDataProperties.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,34 +31,44 @@ namespace OWLSharp.Ontology
3131
public sealed class OWLDisjointDataProperties : OWLDataPropertyAxiom
3232
{
3333
#region Properties
34+
/// <summary>
35+
/// The set of data properties asserted to be pairwise disjoint (e.g: http://example.org/birthDate, http://example.org/deathDate)
36+
/// </summary>
3437
[XmlElement(ElementName="DataProperty", Order=2)]
3538
public List<OWLDataProperty> DataProperties { get; set; }
3639
#endregion
3740

3841
#region Ctors
39-
internal OWLDisjointDataProperties()
40-
{ }
42+
internal OWLDisjointDataProperties() { }
43+
44+
/// <summary>
45+
/// Builds an OWLDisjointDataProperties with the given set of data properties (must be at least 2)
46+
/// </summary>
47+
/// <exception cref="OWLException"></exception>
4148
public OWLDisjointDataProperties(List<OWLDataProperty> dataProperties) : this()
4249
{
4350
#region Guards
4451
if (dataProperties == null)
45-
throw new OWLException("Cannot create OWLDisjointDataProperties because given \"dataProperties\" parameter is null");
52+
throw new OWLException($"Cannot create OWLDisjointDataProperties because given '{nameof(dataProperties)}' parameter is null");
4653
if (dataProperties.Count < 2)
47-
throw new OWLException("Cannot create OWLDisjointDataProperties because given \"dataProperties\" parameter must contain at least 2 elements");
54+
throw new OWLException($"Cannot create OWLDisjointDataProperties because given '{nameof(dataProperties)}' parameter must contain at least 2 elements");
4855
if (dataProperties.Any(dp => dp == null))
49-
throw new OWLException("Cannot create OWLDisjointDataProperties because given \"dataProperties\" parameter contains a null element");
56+
throw new OWLException($"Cannot create OWLDisjointDataProperties because given '{nameof(dataProperties)}' parameter contains a null element");
5057
#endregion
5158

5259
DataProperties = dataProperties;
5360
}
5461
#endregion
5562

5663
#region Methods
64+
/// <summary>
65+
/// Exports this OWLDisjointDataProperties to an equivalent RDFGraph object
66+
/// </summary>
5767
public override RDFGraph ToRDFGraph()
5868
{
5969
RDFGraph graph = new RDFGraph();
6070

61-
//propertyDisjointWith
71+
//owl:propertyDisjointWith
6272
if (DataProperties.Count == 2)
6373
{
6474
graph = graph.UnionWith(DataProperties[0].ToRDFGraph())
@@ -73,7 +83,7 @@ public override RDFGraph ToRDFGraph()
7383
graph = graph.UnionWith(annotation.ToRDFGraph(axiomTriple));
7484
}
7585

76-
//AllDisjointProperties
86+
//owl:AllDisjointProperties
7787
else
7888
{
7989
RDFResource allDisjointPropertiesIRI = new RDFResource();

OWLSharp/Ontology/Axioms/DataPropertyAxioms/OWLEquivalentDataProperties.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,39 @@ namespace OWLSharp.Ontology
3232
public sealed class OWLEquivalentDataProperties : OWLDataPropertyAxiom
3333
{
3434
#region Properties
35+
/// <summary>
36+
/// The set of data properties asserted to be equivalent (e.g: http://example.org/hasAge, http://example.org/age)
37+
/// </summary>
3538
[XmlElement(ElementName="DataProperty", Order=2)]
3639
public List<OWLDataProperty> DataProperties { get; set; }
3740
#endregion
3841

3942
#region Ctors
40-
internal OWLEquivalentDataProperties()
41-
{ }
43+
internal OWLEquivalentDataProperties() { }
44+
45+
/// <summary>
46+
/// Builds an OWLEquivalentDataProperties with the given set of data properties (must be at least 2)
47+
/// </summary>
48+
/// <exception cref="OWLException"></exception>
4249
public OWLEquivalentDataProperties(List<OWLDataProperty> dataProperties) : this()
4350
{
4451
#region Guards
4552
if (dataProperties == null)
46-
throw new OWLException("Cannot create OWLEquivalentDataProperties because given \"dataProperties\" parameter is null");
53+
throw new OWLException($"Cannot create OWLEquivalentDataProperties because given '{nameof(dataProperties)}' parameter is null");
4754
if (dataProperties.Count < 2)
48-
throw new OWLException("Cannot create OWLEquivalentDataProperties because given \"dataProperties\" parameter must contain at least 2 elements");
55+
throw new OWLException($"Cannot create OWLEquivalentDataProperties because given '{nameof(dataProperties)}' parameter must contain at least 2 elements");
4956
if (dataProperties.Any(dp => dp == null))
50-
throw new OWLException("Cannot create OWLEquivalentObjectProperties because given \"dataProperties\" parameter contains a null element");
57+
throw new OWLException($"Cannot create OWLEquivalentDataProperties because given '{nameof(dataProperties)}' parameter contains a null element");
5158
#endregion
5259

5360
DataProperties = dataProperties;
5461
}
5562
#endregion
5663

5764
#region Methods
65+
/// <summary>
66+
/// Exports this OWLEquivalentDataProperties to an equivalent RDFGraph object
67+
/// </summary>
5868
public override RDFGraph ToRDFGraph()
5969
{
6070
RDFGraph graph = new RDFGraph();
@@ -69,7 +79,7 @@ public override RDFGraph ToRDFGraph()
6979
//Axiom Triple(s)
7080
List<RDFTriple> axiomTriples = new List<RDFTriple>();
7181
for (int i = 0; i < DataProperties.Count - 1; i++)
72-
for (int j = i + 1; j < DataProperties.Count; j++)
82+
for (int j = i+1; j < DataProperties.Count; j++)
7383
{
7484
RDFTriple axiomTriple = new RDFTriple(dtPropIRIs[i], RDFVocabulary.OWL.EQUIVALENT_PROPERTY, dtPropIRIs[j]);
7585
axiomTriples.Add(axiomTriple);

OWLSharp/Ontology/Axioms/DataPropertyAxioms/OWLFunctionalDataProperty.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,31 @@ namespace OWLSharp.Ontology
3131
public sealed class OWLFunctionalDataProperty : OWLDataPropertyAxiom
3232
{
3333
#region Properties
34+
/// <summary>
35+
/// The data property asserted to have functional behavior (e.g: http://example.org/hasSSN)
36+
/// </summary>
3437
[XmlElement(Order=2)]
3538
public OWLDataProperty DataProperty { get; set; }
3639
#endregion
3740

3841
#region Ctors
39-
internal OWLFunctionalDataProperty()
40-
{ }
42+
internal OWLFunctionalDataProperty() { }
43+
44+
/// <summary>
45+
/// Builds an OWLFunctionalDataProperty with the given data property
46+
/// </summary>
47+
/// <exception cref="OWLException"></exception>
4148
public OWLFunctionalDataProperty(OWLDataProperty dataProperty) : this()
42-
=> DataProperty = dataProperty ?? throw new OWLException("Cannot create OWLFunctionalDataProperty because given \"dataProperty\" parameter is null");
49+
=> DataProperty = dataProperty ?? throw new OWLException($"Cannot create OWLFunctionalDataProperty because given '{nameof(dataProperty)}' parameter is null");
4350
#endregion
4451

4552
#region Methods
53+
/// <summary>
54+
/// Exports this OWLFunctionalDataProperty to an equivalent RDFGraph object
55+
/// </summary>
4656
public override RDFGraph ToRDFGraph()
4757
{
48-
RDFGraph graph = new RDFGraph();
49-
graph = graph.UnionWith(DataProperty.ToRDFGraph());
58+
RDFGraph graph = DataProperty.ToRDFGraph();
5059

5160
//Axiom Triple
5261
RDFTriple axiomTriple = new RDFTriple(DataProperty.GetIRI(), RDFVocabulary.RDF.TYPE, RDFVocabulary.OWL.FUNCTIONAL_PROPERTY);

OWLSharp/Ontology/Axioms/DataPropertyAxioms/OWLSubDataPropertyOf.cs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,41 @@ namespace OWLSharp.Ontology
3030
public sealed class OWLSubDataPropertyOf : OWLDataPropertyAxiom
3131
{
3232
#region Properties
33+
/// <summary>
34+
/// The data property representing the "child" in the hierarchy (e.g: http://example.org/hasBirthDate)
35+
/// </summary>
3336
[XmlElement(ElementName="DataProperty", Order=2)]
3437
public OWLDataProperty SubDataProperty { get; set; }
3538

39+
/// <summary>
40+
/// The data property representing the "mother" in the hierarchy (e.g: http://example.org/hasDate)
41+
/// </summary>
3642
[XmlElement(ElementName="DataProperty", Order=3)]
3743
public OWLDataProperty SuperDataProperty { get; set; }
3844
#endregion
3945

4046
#region Ctors
41-
internal OWLSubDataPropertyOf()
42-
{ }
47+
internal OWLSubDataPropertyOf() { }
48+
49+
/// <summary>
50+
/// Builds an OWLSubDataPropertyOf with the given child and mother data properties
51+
/// </summary>
52+
/// <exception cref="OWLException"></exception>
4353
public OWLSubDataPropertyOf(OWLDataProperty subDataProperty, OWLDataProperty superDataProperty) : this()
4454
{
45-
SubDataProperty = subDataProperty ?? throw new OWLException("Cannot create OWLSubDataPropertyOf because given \"subDataProperty\" parameter is null");
46-
SuperDataProperty = superDataProperty ?? throw new OWLException("Cannot create OWLSubDataPropertyOf because given \"superDataProperty\" parameter is null");
55+
SubDataProperty = subDataProperty ?? throw new OWLException($"Cannot create OWLSubDataPropertyOf because given '{nameof(subDataProperty)}' parameter is null");
56+
SuperDataProperty = superDataProperty ?? throw new OWLException($"Cannot create OWLSubDataPropertyOf because given '{nameof(superDataProperty)}' parameter is null");
4757
}
4858
#endregion
4959

5060
#region Methods
61+
/// <summary>
62+
/// Exports this OWLSubDataPropertyOf to an equivalent RDFGraph object
63+
/// </summary>
5164
public override RDFGraph ToRDFGraph()
5265
{
53-
RDFGraph graph = new RDFGraph();
54-
graph = graph.UnionWith(SubDataProperty.ToRDFGraph())
55-
.UnionWith(SuperDataProperty.ToRDFGraph());
66+
RDFGraph graph = SubDataProperty.ToRDFGraph()
67+
.UnionWith(SuperDataProperty.ToRDFGraph());
5668

5769
//Axiom Triple
5870
RDFTriple axiomTriple = new RDFTriple(SubDataProperty.GetIRI(), RDFVocabulary.RDFS.SUB_PROPERTY_OF, SuperDataProperty.GetIRI());

0 commit comments

Comments
 (0)