Skip to content

Commit ef8af97

Browse files
fix:remove code completion
1 parent 2d9b48c commit ef8af97

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/Page1.playgroundpage/Manifest.plist

+2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
<true/>
99
<key>LiveViewMode</key>
1010
<string>VisibleByDefault</string>
11+
<key>PlaygroundLoggingMode</key>
12+
<string>Off</string>
1113
</dict>
1214
</plist>

PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/Page2.playgroundpage/main.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//:
1212
//: Suppose you want to know the capital of China, through the triplet "China-Capital-Beijing" you can easily get the answer to the question with other entities information related to Beijing, it is similar to the behavior when you search for the capital of China in the online search engine. In fact, many search engines use knowledge graph-related techniques.
1313
//: ## Storage methods of Knowledge Graph
14-
//: To help you understand the knowledge graph in a simple way, a basic simulation of the structure of the knowledge graph is given in this playground. In real scenarios, there are two main methods to store the knowledge graph.
14+
//: To help you understand the knowledge graph in a easy way, a basic simulation of the structure of the knowledge graph is given in this playground. In the actual production environment, there are two main methods to store the knowledge graph.
1515
//:
1616
//: **RDF** RDF stands for Resource Description Framework and it’s a W3C standard for data exchange in the Web. RDF consists of nodes and edges. Nodes represent entities and resources, attributes, while edges represent the relationship between entities and entities, as well as the relationship between entities and attributes.
1717
//:

PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/Page3.playgroundpage/Manifest.plist

+2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
<true/>
99
<key>LiveViewMode</key>
1010
<string>VisibleByDefault</string>
11+
<key>PlaygroundLoggingMode</key>
12+
<string>Off</string>
1113
</dict>
1214
</plist>

PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/Page3.playgroundpage/main.swift

-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ import BookCore
2222
import PlaygroundSupport
2323
var userGraph: (Graph) -> Graph = { graph in
2424
//#-end-hidden-code
25-
//#-code-completion(everything, hide)
26-
//#-code-completion(identifier, show, graph.addEntity(_ entity: Entity))
27-
//#-code-completion(identifier, show, graph.addEntities(_ entitiesToAdd: [Entity]))
28-
//#-code-completion(identifier, show, graph.addRelation(_ entity: Entity, to anotherEntity: Entity, relation: String))
29-
//#-code-completion(identifier, show, graph.updateRelation(_ firstEntity: Entity, to secondEntity: Entity, relation: String))
30-
//#-code-completion(identifier, show, graph.deleteEntity(_ entityToDelete: EntityID))
3125
//#-editable-code
3226
let Apple = Entity(text: "Apple")
3327
let Fruit = Entity(text: "Fruit")

PlaygroundBook/Modules/BookCore.playgroundmodule/Sources/Model/Graph.swift

+4-6
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,22 @@ extension Graph {
102102
edges = newSet
103103
}
104104

105-
public func addRelation(_ entity: Entity, to anotherEntity: Entity, relation: String){
105+
public func addRelation(_ entity: Entity, to secondEntity: Entity, relation: String){
106106
let center = entity.position
107107
let radius = 300.0
108108
let angle = CGFloat.random(in: 1.0..<360.0) * CGFloat.pi/180.0
109109
let point = CGPoint(x: center.x + CGFloat(radius) * cos(angle), y: center.y + CGFloat(radius) * sin(angle))
110110

111-
self.positionEntity(anotherEntity, position: point)
112-
connect(entity, to: anotherEntity, relation: relation)
111+
self.positionEntity(secondEntity, position: point)
112+
connect(entity, to: secondEntity, relation: relation)
113113
rebuildLinks()
114114
}
115115

116116
public func deleteEntity(_ entity: Entity) {
117117
deleteEntity(entity.id)
118118
}
119119

120-
public func updateEntity(_ entity: Entity, text: String) {
120+
func updateEntity(_ entity: Entity, text: String) {
121121
var newEntity = entity
122122
newEntity.text = text
123123
replace(entity, with: newEntity)
@@ -190,5 +190,3 @@ extension Graph {
190190
return answerEntity?.text ?? ""
191191
}
192192
}
193-
194-

0 commit comments

Comments
 (0)